[gnome-builder] flatpak: allow building Builder with flatpak



commit 15d3dcb124ce624d1592ff5c787dd9ec3cdf171a
Author: Christian Hergert <chergert redhat com>
Date:   Mon Dec 5 12:08:16 2016 -0800

    flatpak: allow building Builder with flatpak
    
    This adds org.gnome.Builder.json for doing a development build. It also
    sets the Flatpak version to be the default build of the project using the
    .buildconfig file.
    
    We will probably evolve this a bit during the 3.24 cycle once we migrate
    json manifests to be a configuration backend.

 .buildconfig                                       |    8 +
 Makefile.am                                        |    1 +
 ...getting-lib-version-when-using-pkg-config.patch |   27 ++
 build/flatpak/polkit-autogen                       |    4 +
 ...build-Add-option-to-build-without-polkitd.patch |  101 +++++++
 build/flatpak/setuptools-makefile                  |    5 +
 org.gnome.Builder.json                             |  317 ++++++++++++++++++++
 7 files changed, 463 insertions(+), 0 deletions(-)
---
diff --git a/.buildconfig b/.buildconfig
new file mode 100644
index 0000000..24cb913
--- /dev/null
+++ b/.buildconfig
@@ -0,0 +1,8 @@
+[default]
+name=Builder (Development)
+device=local
+runtime=org.gnome.Builder.json@9e139ff87da237d4ecd348e9baa06a3a65e94480
+config-opts=--enable-tracing --enable-debug --enable-hello-cpp-plugin
+prefix=/app
+app-id=org.gnome.Builder
+default=true
diff --git a/Makefile.am b/Makefile.am
index 554dade..4ca03ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
 
 GITIGNOREFILES = \
        **/*.swp \
+       .flatpak-builder \
        *.o \
        aclocal.m4 \
        build-aux \
diff --git a/build/flatpak/lxml-Fix-getting-lib-version-when-using-pkg-config.patch 
b/build/flatpak/lxml-Fix-getting-lib-version-when-using-pkg-config.patch
new file mode 100644
index 0000000..84fcbdd
--- /dev/null
+++ b/build/flatpak/lxml-Fix-getting-lib-version-when-using-pkg-config.patch
@@ -0,0 +1,27 @@
+From d10c98f4bb5e15d5c39bf71206065c3a25754900 Mon Sep 17 00:00:00 2001
+From: Patrick Griffis <tingping tingping se>
+Date: Mon, 22 Aug 2016 17:37:35 -0400
+Subject: [PATCH] Fix getting lib version when using pkg-config
+
+---
+ setupinfo.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/setupinfo.py b/setupinfo.py
+index ecbf961..7cb0d7b 100644
+--- a/setupinfo.py
++++ b/setupinfo.py
+@@ -360,8 +360,8 @@ def check_min_version(version, min_version, error_name):
+ 
+ 
+ def get_library_versions():
+-    xml2_version = run_command(find_xml2_config(), "--version")
+-    xslt_version = run_command(find_xslt_config(), "--version")
++    xml2_version = run_command(find_xml2_config(), "--modversion")
++    xslt_version = run_command(find_xslt_config(), "--modversion")
+     return xml2_version, xslt_version
+ 
+ 
+-- 
+2.9.3
+
diff --git a/build/flatpak/polkit-autogen b/build/flatpak/polkit-autogen
new file mode 100755
index 0000000..3ba457e
--- /dev/null
+++ b/build/flatpak/polkit-autogen
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+gtkdocize --flavour no-tmpl
+autoreconf -if
diff --git a/build/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch 
b/build/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch
new file mode 100644
index 0000000..f201c20
--- /dev/null
+++ b/build/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch
@@ -0,0 +1,101 @@
+From dab179770380918462d0d76e08b11e4abe55c933 Mon Sep 17 00:00:00 2001
+From: Patrick Griffis <tingping tingping se>
+Date: Thu, 8 Sep 2016 16:15:54 -0400
+Subject: [PATCH] build: Add option to build without polkitd
+
+This is for any consumer that needs libpolkit but does
+not need polkitd. For example an application running in
+flatpak.
+---
+ configure.ac     | 29 ++++++++++++++++++++---------
+ src/Makefile.am  |  6 +++++-
+ test/Makefile.am |  6 +++++-
+ 3 files changed, 30 insertions(+), 11 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 97d4222..a08785c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -129,20 +129,30 @@ AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_30],
+ AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,34)],
+         [Notify us when we'll need to transition away from g_type_init()])
+ 
++
++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])
++
++
+ AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@],
+                                 [Specify version of Spidermonkey to use]),,
+             with_mozjs=auto)
+-AS_IF([test x${with_mozjs} != xauto], [
+-  PKG_CHECK_MODULES(LIBJS, ${with_mozjs})
+-], [
+-  PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no)
+-  AS_IF([test x${have_mozjs185} = xno], [
+-  PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes,
+-   [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])])
++
++AS_IF([test x${enable_polkitd} = yes], [
++  AS_IF([test x${with_mozjs} != xauto], [
++    PKG_CHECK_MODULES(LIBJS, ${with_mozjs})
++  ], [
++    PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no)
++    AS_IF([test x${have_mozjs185} = xno], [
++    PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes,
++     [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see 
http://ftp.mozilla.org/pub/mozilla.org/js/])])
++    ])
+   ])
++  AC_SUBST(LIBJS_CFLAGS)
++  AC_SUBST(LIBJS_LIBS)
+ ])
+-AC_SUBST(LIBJS_CFLAGS)
+-AC_SUBST(LIBJS_LIBS)
+ 
+ EXPAT_LIB=""
+ AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
+@@ -605,6 +615,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/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.9.3
+
diff --git a/build/flatpak/setuptools-makefile b/build/flatpak/setuptools-makefile
new file mode 100644
index 0000000..96c28f0
--- /dev/null
+++ b/build/flatpak/setuptools-makefile
@@ -0,0 +1,5 @@
+all:
+       python3 ./setup.py build
+
+install:
+       python3 ./setup.py install --prefix=/app --skip-build --optimize=1
diff --git a/org.gnome.Builder.json b/org.gnome.Builder.json
new file mode 100644
index 0000000..949816d
--- /dev/null
+++ b/org.gnome.Builder.json
@@ -0,0 +1,317 @@
+{
+    "app-id": "org.gnome.Builder",
+    "runtime": "org.gnome.Sdk",
+    "runtime-version": "master",
+    "sdk": "org.gnome.Sdk",
+    "command": "gnome-builder",
+    "tags": ["devel"],
+    "desktop-file-name-prefix": "(Development) ",
+    "finish-args": [
+        /* Allow access to developer tools */
+        "--allow=devel",
+        "--talk-name=org.freedesktop.Flatpak",
+        /* X11 + XShm access */
+        "--share=ipc", "--socket=x11",
+        /* Wayland access */
+        "--socket=wayland",
+        /* We want full fs access */
+        "--filesystem=host",
+        /* Needs to talk to the network: */
+        "--share=network",
+        "--talk-name=org.gtk.vfs.*",
+        /* Needs access to policykit for flatpak and sysprof */
+        "--system-talk-name=org.freedesktop.PolicyKit1",
+        /* Needs access to host sysprofd for profiling */
+        "--system-talk-name=org.gnome.Sysprof2",
+        /* Needed for dconf to work (+ host or homedir read access from above) */
+        "--filesystem=xdg-run/dconf",
+        "--filesystem=~/.config/dconf:ro",
+        "--talk-name=ca.desrt.dconf",
+        "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
+        /* We need access to auth agents */
+        "--talk-name=org.freedesktop.secrets",
+       "--filesystem=xdg-run/keyring",
+        /* Needed for various SSL certificates to work */
+        "--env=SSL_CERT_DIR=/etc/ssl/certs",
+        "--filesystem=/etc/ssl:ro",
+        "--filesystem=/etc/pki:ro",
+        "--filesystem=/etc/ca-certificates:ro",
+        "--filesystem=/var/lib/flatpak"
+    ],
+    "build-options" : {
+        "cflags": "-O2 -g",
+        "cxxflags": "-O2 -g",
+        "env": {
+            "MOUNT_FUSE_PATH": "../tmp/",
+            "V": "1"
+        }
+    },
+    "cleanup": ["/include", "/lib/pkgconfig", "/lib/cmake",
+                "/share/pkgconfig", "/share/aclocal",
+                "/share/mm-common", "/bin/mm-*",
+                "/man", "/share/man", "/share/gtk-doc",
+                "/share/doc", "/share/vala", "/share/appdata",
+                "/share/bash-completions",
+                "/lib/sigc++-2.0", "/lib/glibmm-2.4", "/lib/giomm-2.4",
+                "*.la", "*.a"],
+    "modules": [
+        {
+            "name": "libfuse",
+            "cleanup": [ "/bin" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": 
"https://github.com/libfuse/libfuse/releases/download/fuse_2_9_5/fuse-2.9.5.tar.gz";,
+                    "sha256": "579f371cc5ffc1afca7057512bf7d52988a9ede57859a7c55e5b9f72435cdbb5"
+                }
+            ]
+        },
+        {
+            "name": "libgsystem",
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/libgsystem.git"
+                }
+            ]
+        },
+        {
+            "name": "ostree",
+            "config-opts": [ "--disable-man" ],
+            "cleanup": [ "/bin",
+                         "/etc/grub.d",
+                         "/etc/ostree",
+                         "/share/ostree",
+                         "/libexec" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/ostreedev/ostree.git";
+                }
+            ]
+        },
+        {
+            "name": "flatpak",
+            "config-opts": [ "--disable-documentation",
+                             "--disable-seccomp",
+                             "--disable-sandboxed-triggers",
+                             "--disable-system-helper",
+                             "--with-system-install-dir=/var/lib/flatpak" ],
+            "cleanup": [ "/etc/profile.d",
+                         "/bin/flatpak",
+                         "/bin/flatpak-builder",
+                         "/libexec",
+                         "/lib/systemd",
+                         "/share/dbus-1/interfaces/org.freedesktop.*",
+                         "/share/dbus-1/services/org.freedesktop.*",
+                         "/share/gdm" ],
+            "post-install": [ "cp /usr/bin/update-mime-database /app/bin",
+                              "cp /usr/bin/update-desktop-database /app/bin" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/flatpak/flatpak.git";
+                }
+            ]
+        },
+        {
+            "name": "polkit",
+            "config-opts": [ "--disable-polkitd", "--disable-man-pages", "--disable-introspection" ],
+            "rm-configure": true,
+            "cleanup": [ "/bin/*",
+                         "/etc/pam.d",
+                         "/etc/dbus-1",
+                         "/share/dbus-1/system-services/*",
+                         "/share/polkit-1/actions/*",
+                         "/lib/polkit-1" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "http://www.freedesktop.org/software/polkit/releases/polkit-0.113.tar.gz";,
+                    "sha256": "e1c095093c654951f78f8618d427faf91cf62abdefed98de40ff65eca6413c81"
+                },
+                {
+                    "type": "patch",
+                    "path": "build/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch"
+                },
+                {
+                    "type": "file",
+                    "path": "build/flatpak/polkit-autogen",
+                    "dest-filename": "autogen.sh"
+                }
+            ]
+        },
+        {
+            "name": "python3-jedi",
+            "no-autogen": true,
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://pypi.python.org/packages/source/j/jedi/jedi-0.9.0.tar.gz";,
+                    "sha256": "3b4c19fba31bdead9ab7350fb9fa7c914c59b0a807dcdd5c00a05feb85491d31"
+                },
+                {
+                    "type": "file",
+                    "path": "build/flatpak/setuptools-makefile",
+                    "dest-filename": "Makefile"
+                }
+            ]
+        },
+        {
+            "name": "python3-lxml",
+            "no-autogen": true,
+            "build-options": {
+                "cflags": "-I/usr/include",
+                "env": {
+                    "XSLT_CONFIG": "pkg-config libxslt",
+                    "XML2_CONFIG": "pkg-config libxml-2.0"
+                }
+            },
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://pypi.io/packages/source/l/lxml/lxml-3.6.4.tar.gz";,
+                    "sha256": "61d5d3e00b5821e6cda099b3b4ccfea4527bf7c595e0fb3a7a760490cedd6172"
+                },
+                {
+                    "type": "file",
+                    "path": "build/flatpak/setuptools-makefile",
+                    "dest-filename": "Makefile"
+                },
+                {
+                    "type": "patch",
+                    "path": "build/flatpak/lxml-Fix-getting-lib-version-when-using-pkg-config.patch"
+                }
+            ]
+        },
+        {
+            "name": "libssh2",
+            "cmake": true,
+            "config-opts": [ "-DCMAKE_INSTALL_LIBDIR:PATH=/app/lib",
+                             "-DBUILD_SHARED_LIBS:BOOL=ON" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/libssh2/libssh2.git";,
+                    "branch": "libssh2-1.6.0"
+                }
+            ]
+        },
+        {
+            "name": "libgit2",
+            "cmake": true,
+            "config-opts": [ "-DBUILD_SHARED_LIBS:BOOL=ON",
+                             "-DTHREADSAFE=ON" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "https://github.com/libgit2/libgit2.git";,
+                    "branch": "maint/v0.24"
+                }
+            ]
+        },
+        {
+            "name": "libgit2-glib",
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/libgit2-glib"
+                }
+            ]
+        },
+        {
+            "name": "libpeas",
+            "cleanup": [ "/bin/*", "/lib/peas-demo" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/libpeas"
+                }
+            ]
+        },
+        {
+            "name": "gtksourceview",
+            "sources": [
+                {
+                    "branch": "gnome-3-24",
+                    "type": "git",
+                    "url": "git://git.gnome.org/gtksourceview"
+                }
+            ]
+        },
+        {
+            "name": "mm-common",
+            "config-opts": [ "--disable-documentation" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://download.gnome.org/sources/mm-common/0.9/mm-common-0.9.10.tar.xz";,
+                    "sha256": "16c0e2bc196b67fbc145edaecb5dbe5818386504fe5703de27002d77140fa217"
+                }
+            ]
+        },
+        {
+            "name": "libsigcplusplus",
+            "config-opts": [ "--disable-documentation" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://download.gnome.org/sources/libsigc++/2.9/libsigc++-2.9.3.tar.xz";,
+                    "sha256": "0bf9b301ad6198c550986c51150a646df198e8d1d235270c16486b0dda30097f"
+                }
+            ]
+        },
+        {
+            "name": "glibmm",
+            "config-opts": [ "--disable-documentation" ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://download.gnome.org/sources/glibmm/2.49/glibmm-2.49.5.tar.xz";,
+                    "sha256": "4e9c147c3fd3b8ecb15b3d5bdc120ef4e88a5d6948c8e82c3d95f85add33304e"
+                }
+            ]
+        },
+        {
+            "name": "devhelp",
+            "config-opts": [ "--disable-compile-warnings" ],
+            "cleanup": [ "/bin/*", "/lib/gedit/plugins", "/share/applications/*", "/share/dbus-1/services", 
"/share/GConf" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/devhelp"
+                }
+            ]
+        },
+        {
+            "name": "json-glib",
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/json-glib"
+                }
+            ]
+        },
+        {
+            "name": "sysprof",
+            "config-opts": [ "--enable-gtk", "--with-sysprofd=host" ],
+            "cleanup": [ "/bin/*", "/libexec/sysprof", "/share/applications/*", "/share/mime/packages" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/sysprof"
+                }
+            ]
+        },
+        {
+            "name": "gnome-builder",
+            "config-opts": [ "--enable-tracing", "--enable-debug" ],
+            "sources": [
+                {
+                    "type": "git",
+                    "url": "git://git.gnome.org/gnome-builder"
+                }
+            ]
+        }
+    ]
+}


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