[simple-scan] flatpak: Add development purpose flatpak



commit 20edd1bcb0aa0f15a4d23f424bed46a3e0de638f
Author: Vanadiae <vanadiae35 gmail com>
Date:   Fri Dec 11 08:56:00 2020 +0000

    flatpak: Add development purpose flatpak
    
    This commit adds a flatpak manifest meant to develop easily by simply
    clicking the Run button is Builder without having to manually install
    dependency.

 .gitlab-ci.yml                                     |  12 ++
 README.md                                          |  15 +-
 build-aux/flatpak/org.gnome.SimpleScan.json        | 229 +++++++++++++++++++++
 build-aux/flatpak/polkit-autogen                   |   4 +
 ...build-Add-option-to-build-without-polkitd.patch | 132 ++++++++++++
 {snap => build-aux/snap}/snapcraft.yaml            |   0
 6 files changed, 391 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72d7ad58..e0325b8a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,3 +33,15 @@ build-arch:
   script:
     - meson _build
     - ninja -C _build install
+
+include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
+
+flatpak:
+    image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
+    variables:
+        MANIFEST_PATH: "build-aux/flatpak/org.gnome.SimpleScan.json"
+        FLATPAK_MODULE: "simple-scan"
+        APP_ID: "org.gnome.SimpleScan"
+        RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
+        BUNDLE: "simple-scan-dev.flatpak"
+    extends: '.flatpak'
diff --git a/README.md b/README.md
index 3d96f55b..7516452d 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,20 @@
 It allows you to capture images using [image scanners](https://en.wikipedia.org/wiki/Image_scanner)
 (e.g. flatbed scanners) that have suitable [SANE drivers](http://sane-project.org/) installed.
 
-# Building from source
+# Building the flatpak with GNOME Builder
+
+It is recommended to use the development flatpak for developing this application.
+That way you won't have to download all dependencies yourself and it'll be consistent between all distros.
+
+1. Download [GNOME Builder](https://flathub.org/apps/details/org.gnome.Builder)
+2. Click the `Clone Repository` button in Builder and use https://gitlab.gnome.org/GNOME/simple-scan.git as 
the URL.
+3. Click the Run button in the headerbar
+
+Note that this flatpak requires access to all devices (--device=all), and so isn't made for general use.
+For this reason and until a more suitable solution is found to interact with a host `saned`, please don't
+try to publish it on Flathub.
+
+# Building manually from source
 
 Install the dependencies
 
diff --git a/build-aux/flatpak/org.gnome.SimpleScan.json b/build-aux/flatpak/org.gnome.SimpleScan.json
new file mode 100644
index 00000000..3bf84f69
--- /dev/null
+++ b/build-aux/flatpak/org.gnome.SimpleScan.json
@@ -0,0 +1,229 @@
+{
+    "app-id" : "org.gnome.SimpleScan",
+    "runtime" : "org.gnome.Sdk",
+    "runtime-version" : "master",
+    "sdk" : "org.gnome.Sdk",
+    "command" : "simple-scan",
+    "rename-desktop-file" : "simple-scan.desktop",
+    "tags" : [
+        "devel"
+    ],
+    "desktop-file-name-prefix" : "(Development) ",
+    "finish-args" : [
+        "--device=dri",
+        "--device=all",
+        "--share=network",
+        "--socket=fallback-x11",
+        "--socket=pulseaudio",
+        "--socket=wayland"
+    ],
+    "cleanup" : [
+        "/include",
+        "/share/aclocal",
+        "/man",
+        "/share/man",
+        "/share/gtk-doc",
+        "/share/vala",
+        "*.la",
+        "*.a"
+    ],
+    "modules" : [
+        {
+            "name" : "libusb1",
+            "buildsystem" : "autotools",
+            "config-opts" : [
+                "--disable-udev"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/libusb/libusb.git";
+                }
+            ]
+        },
+        {
+            "name" : "gusb",
+            "buildsystem" : "meson",
+            "config-opts" : [
+                "-Ddocs=false",
+                "-Dtests=false"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/hughsie/libgusb.git";
+                }
+            ]
+        },
+        {
+            "name" : "udev",
+            "config-opts" : [
+                "--disable-hwdb",
+                "--disable-logging",
+                "--disable-gudev",
+                "--disable-introspection",
+                "--disable-keymap",
+                "--disable-mtd_probe"
+            ],
+            "cleanup" : [
+                "/include",
+                "/etc",
+                "/libexec",
+                "/sbin",
+                "/lib/pkgconfig",
+                "/man",
+                "/share/aclocal",
+                "/share/doc",
+                "/share/gtk-doc",
+                "/share/man",
+                "/share/pkgconfig",
+                "*.la",
+                "*.a"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/gentoo/eudev.git";
+                }
+            ]
+        },
+        {
+            "name" : "gudev",
+            "buildsystem" : "meson",
+            "config-opts" : [
+                "-Dtests=disabled",
+                "-Dintrospection=disabled"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/libgudev.git";
+                }
+            ]
+        },
+        {
+            "name": "intltool",
+            "cleanup": [ "*" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz";,
+                    "sha256": "67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd"
+                }
+            ]
+        },
+        {
+            "name" : "polkit",
+            "buildsystem" : "autotools",
+            "config-opts" : [
+                "--disable-polkitd",
+                "--disable-man-pages",
+                "--disable-introspection",
+                "--disable-examples",
+                "--disable-gtk-doc",
+                "--disable-libelogind",
+                "--disable-libsystemd-login",
+                "--with-systemdsystemunitdir=no",
+                "--with-authdb=dummy",
+                "--with-authfw=none"
+            ],
+            "rm-configure" : true,
+            "cleanup" : [
+                "/bin/*",
+                "/etc/pam.d",
+                "/etc/dbus-1",
+                "/share/dbus-1/system-services/*",
+                "/share/polkit-1",
+                "/lib/polkit-1"
+            ],
+            "sources" : [
+                {
+                    "type" : "archive",
+                    "url" : "https://www.freedesktop.org/software/polkit/releases/polkit-0.116.tar.gz";,
+                    "sha256" : "88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1"
+                },
+                {
+                    "type" : "patch",
+                    "path" : "polkit-build-Add-option-to-build-without-polkitd.patch"
+                },
+                {
+                    "type" : "file",
+                    "path" : "polkit-autogen",
+                    "dest-filename" : "autogen.sh"
+                }
+            ]
+        },
+        {
+            "name" : "colord",
+            "buildsystem" : "meson",
+            "config-opts" : [
+                "-Dargyllcms_sensor=false",
+                "-Dbash_completion=false",
+                "-Dman=false",
+                "-Dudev_rules=false",
+                "-Dsystemd=false",
+                "-Ddocs=false",
+                "-Dtests=false",
+                "-Dinstalled_tests=false",
+                "-Dvapi=true"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/hughsie/colord.git";
+                }
+            ]
+        },
+        {
+            "name" : "packagekit-glib2",
+            "buildsystem" : "meson",
+            "config-opts" : [
+                "-Dpackaging_backend=dummy",
+                "-Dman_pages=false",
+                "-Dgstreamer_plugin=false",
+                "-Doffline_update=false",
+                "-Dbash_completion=false",
+                "-Dbash_command_not_found=false",
+                "-Dsystemd=false"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/hughsie/PackageKit.git";
+                }
+            ]
+        },
+        {
+            "name" : "gphoto2",
+            "buildsystem" : "autotools",
+            "sources" : [
+                {
+                    "type" : "archive",
+                    "url" : 
"https://sourceforge.net/projects/gphoto/files/libgphoto/2.5.26/libgphoto2-2.5.26.tar.bz2";,
+                    "sha256" : "7740fea3cbb78489071cdfec06c07fab528e69e27ac82734eae6a73eaeeabcd4"
+                }
+            ]
+        },
+        {
+            "name" : "sane-backends",
+            "buildsystem" : "autotools",
+            "sources" : [
+                {
+                    "type" : "archive",
+                    "url" : 
"https://gitlab.com/sane-project/backends/uploads/8bf1cae2e1803aefab9e5331550e5d5d/sane-backends-1.0.31.tar.gz";,
+                    "sha256" : "4a3b10fcb398ed854777d979498645edfe66fcac2f2fd2b9117a79ff45e2a5aa"
+                }
+            ]
+        },
+        {
+            "name" : "simple-scan",
+            "buildsystem" : "meson",
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/simple-scan.git";
+                }
+            ]
+        }
+    ]
+}
diff --git a/build-aux/flatpak/polkit-autogen b/build-aux/flatpak/polkit-autogen
new file mode 100755
index 00000000..3ba457e5
--- /dev/null
+++ b/build-aux/flatpak/polkit-autogen
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+gtkdocize --flavour no-tmpl
+autoreconf -if
diff --git a/build-aux/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch 
b/build-aux/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch
new file mode 100644
index 00000000..651f53ba
--- /dev/null
+++ b/build-aux/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch
@@ -0,0 +1,132 @@
+From 1073a44277316348d40d86ecec908f1d4812f360 Mon Sep 17 00:00:00 2001
+From: Christian Hergert <chergert redhat com>
+Date: Mon, 27 May 2019 11:49:09 -0700
+Subject: [PATCH] flatpak: make polkit suitable for use within flatpak
+
+This is based on patches from Patrick Griffis with additional fixes
+to allow us to disable use of PAM within Flaptak.
+---
+ configure.ac                | 20 ++++++++++++++++----
+ src/Makefile.am             |  6 +++++-
+ src/polkitagent/Makefile.am |  5 +++++
+ test/Makefile.am            |  6 +++++-
+ 4 files changed, 31 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5cedb4e..729d78d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -79,11 +79,13 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+ 
+-PKG_CHECK_MODULES(LIBJS, [mozjs-60])
++AS_IF([test x${enable_polkitd} = yes], [
++  PKG_CHECK_MODULES(LIBJS, [mozjs-60])
+ 
+-AC_SUBST(LIBJS_CFLAGS)
+-AC_SUBST(LIBJS_CXXFLAGS)
+-AC_SUBST(LIBJS_LIBS)
++  AC_SUBST(LIBJS_CFLAGS)
++  AC_SUBST(LIBJS_CXXFLAGS)
++  AC_SUBST(LIBJS_LIBS)
++])
+ 
+ EXPAT_LIB=""
+ AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
+@@ -236,6 +238,15 @@ if test "x$with_systemdsystemunitdir" != "xno"; then
+ fi
+ AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
+ 
++dnl ---------------------------------------------------------------------------
++dnl - Disable polkitd when using library alone
++dnl ---------------------------------------------------------------------------
++
++AC_ARG_ENABLE([polkitd],
++              [AS_HELP_STRING([--disable-polkitd], [Do not build polkitd])],
++              [enable_polkitd=$enableval], [enable_polkitd=yes])
++AM_CONDITIONAL(BUILD_POLKITD, [test x${enable_polkitd} = yes])
++
+ dnl ---------------------------------------------------------------------------
+ dnl - User for running polkitd
+ dnl ---------------------------------------------------------------------------
+@@ -579,6 +590,7 @@ echo "
+         Session tracking:           ${SESSION_TRACKING}
+         PAM support:                ${have_pam}
+         systemdsystemunitdir:       ${systemdsystemunitdir}
++        polkitd:                    ${enable_polkitd}
+         polkitd user:               ${POLKITD_USER}"
+ 
+ if test "$have_pam" = yes ; then
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 09fc7b3..c6fe91b 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,5 +1,9 @@
+ 
+-SUBDIRS = polkit polkitbackend polkitagent programs
++SUBDIRS = polkit polkitagent programs
++
++if BUILD_POLKITD
++SUBDIRS += polkitbackend
++endif
+ 
+ if BUILD_EXAMPLES
+ SUBDIRS += examples
+diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am
+index 49720db..633f9d4 100644
+--- a/src/polkitagent/Makefile.am
++++ b/src/polkitagent/Makefile.am
+@@ -79,6 +79,7 @@ libpolkit_agent_1_la_LIBADD =                                        \
+ 
+ libpolkit_agent_1_la_LDFLAGS = -export-symbols-regex '(^polkit_.*)'
+ 
++if !POLKIT_AUTHFW_NONE
+ libprivdir = $(prefix)/lib/polkit-1
+ libpriv_PROGRAMS = polkit-agent-helper-1
+ 
+@@ -113,6 +114,8 @@ polkit_agent_helper_1_LDFLAGS =                                    \
+       $(AM_LDFLAGS)                                                   \
+       $(NULL)
+ 
++endif # !POLKIT_AUTHFW_NONE
++
+ if HAVE_INTROSPECTION
+ 
+ girdir = $(INTROSPECTION_GIRDIR)
+@@ -142,6 +145,7 @@ include $(INTROSPECTION_MAKEFILE)
+ 
+ endif # HAVE_INTROSPECTION
+ 
++if !POLKIT_AUTHFW_NONE
+ # polkit-agent-helper-1 need to be setuid root because it's used to
+ # authenticate not only the invoking user, but possibly also root
+ # and/or other users.
+@@ -149,6 +153,7 @@ endif # HAVE_INTROSPECTION
+ install-data-hook:
+       -chown root $(DESTDIR)$(libprivdir)/polkit-agent-helper-1
+       -chmod 4755 $(DESTDIR)$(libprivdir)/polkit-agent-helper-1
++endif # !POLKIT_AUTHFW_NONE
+ 
+ EXTRA_DIST = polkitagentmarshal.list polkitagentenumtypes.h.template polkitagentenumtypes.c.template
+ CLEANFILES = $(gir_DATA) $(typelibs_DATA)
+diff --git a/test/Makefile.am b/test/Makefile.am
+index 59d0680..d43b0fe 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -1,7 +1,11 @@
+ 
+-SUBDIRS = mocklibc . polkit polkitbackend
++SUBDIRS = mocklibc . polkit
+ AM_CFLAGS = $(GLIB_CFLAGS)
+ 
++if BUILD_POLKITD
++SUBDIRS += polkitbackend
++endif
++
+ noinst_LTLIBRARIES = libpolkit-test-helper.la
+ libpolkit_test_helper_la_SOURCES = polkittesthelper.c polkittesthelper.h
+ libpolkit_test_helper_la_LIBADD = $(GLIB_LIBS)
+-- 
+2.21.0
+
diff --git a/snap/snapcraft.yaml b/build-aux/snap/snapcraft.yaml
similarity index 100%
rename from snap/snapcraft.yaml
rename to build-aux/snap/snapcraft.yaml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]