[gitg] Improve bundle



commit f092260755063651643ba63671d70f249c86c539
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Dec 29 23:59:04 2015 +0100

    Improve bundle

 osx/bundle.json.in      |   47 ++++++++++++++++++++++++++++++++++++++-
 osx/scripts/launcher    |    4 +-
 osx/scripts/make-bundle |   55 +++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 100 insertions(+), 6 deletions(-)
---
diff --git a/osx/bundle.json.in b/osx/bundle.json.in
index 08c6d3b..3124417 100644
--- a/osx/bundle.json.in
+++ b/osx/bundle.json.in
@@ -9,14 +9,57 @@
   "main": "${resources}/bin/gitg",
 
   "binaries": {
-    "${prefix}/bin/gitg": "${resources}/bin/gitg"
+    "${prefix}/bin/gitg": "${resources}/bin/gitg",
+
+    "${prefix}/lib/gitg/plugins/*.so": "${resources}/lib/gitg/plugins/"
   },
 
   "data": {
-    "${prefix}/lib/girepository-1.0/*.typelib": "${resources}/lib/girepository-1.0/"
+    "${prefix}/lib/girepository-1.0": {
+      "files": ["Ggit-1.0.typelib", "Gitg-1.0.typelib", "GitgExt-1.0.typelib"],
+      "target": "${resources}/lib/girepository-1.0/"
+    },
+
+    "${pkg:gobject-introspection-1.0:typelibdir}": {
+      "files": [ "Gio-2.0.typelib", "GObject-2.0.typelib", "GLib-2.0.typelib", "GModule-2.0.typelib", 
"GIRepository-2.0.typelib", "cairo-1.0.typelib"],
+      "target": "${resources}/lib/girepository-1.0/"
+    },
+
+    "${pkg:libpeas-1.0:libdir}/girepository-1.0": {
+      "files": ["Peas-1.0.typelib", "PeasGtk-1.0.typelib"],
+      "target": "${resources}/lib/girepository-1.0/"
+    },
+
+    "${pkg:gtk+-3.0:libdir}/girepository-1.0": {
+      "files": ["Gtk-3.0.typelib", "Gdk-3.0.typelib"],
+      "target": "${resources}/lib/girepository-1.0/"
+    },
+
+    "${pkg:pango:libdir}/girepository-1.0/Pango-1.0.typelib": 
"${resources}/lib/girepository-1.0/Pango-1.0.typelib",
+    "${pkg:gdk-pixbuf-2.0:libdir}/girepository-1.0/GdkPixbuf-2.0.typelib": 
"${resources}/lib/girepository-1.0/GdkPixbuf-2.0.typelib",
+    "${pkg:atk:libdir}/girepository-1.0/Atk-1.0.typelib": 
"${resources}/lib/girepository-1.0/Atk-1.0.typelib",
+
+    "${prefix}/lib/gitg/plugins/*.plugin": "${resources}/lib/gitg/plugins/",
+
+    "${pkg:gtk+-3.0:prefix}/share/themes/Mac/gtk-3.0/gtk-keys.css": 
"${resources}/share/themes/Mac/gtk-3.0/gtk-keys.css",
+
+    "${pkg:gtksourceview-3.0:prefix}/share/gtksourceview-3.0/language-specs": 
"${resources}/share/gtksourceview-3.0/language-specs",
+    "${pkg:gtksourceview-3.0:prefix}/share/gtksourceview-3.0/styles": 
"${resources}/share/gtksourceview-3.0/styles",
+
+    "${rootdir}/data/Gitg.icns": "${resources}/Gitg.icns"
   },
 
   "data_interpolated": {
     "${rootdir}/data/Info.plist": "${contents}/Info.plist"
+  },
+
+  "schemas": {
+    "${pkg:glib-2.0:prefix}/share/glib-2.0/schemas/*": "${resources}/share/glib-2.0/schemas/",
+    "${pkg:gsettings-desktop-schemas:prefix}/share/glib-2.0/schemas/*": 
"${resources}/share/glib-2.0/schemas/"  
+  },
+
+  "icon-themes": {
+    "${pkg-root:adwaita-icon-theme}/share/icons/Adwaita": "${resources}/share/icons/Adwaita",
+    "${prefix}/share/gitg/icons/hicolor": "${resources}/share/gitg/icons/hicolor"
   }
 }
diff --git a/osx/scripts/launcher b/osx/scripts/launcher
index 1e7ec5d..f1d4a1a 100644
--- a/osx/scripts/launcher
+++ b/osx/scripts/launcher
@@ -7,7 +7,7 @@ fi
 if test "x$GTK_DEBUG_GDB" != x; then
        EXEC="lldb --"
 elif test "x$GTK_DEBUG_DTRUSS" != x; then
-       EXEC="sudo dtruss sudo -u $USER"
+       EXEC="dtruss"
 else
        EXEC=exec
 fi
@@ -34,7 +34,7 @@ export GTK_DATA_PREFIX="$bundle_res"
 export GTK_EXE_PREFIX="$bundle_res"
 export GTK_PATH="$bundle_res"
 export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
-#export GIO_EXTRA_MODULES="$bundle_lib/gio/modules"
+export GIO_MODULE_DIR="$bundle_lib/gio/modules"
 export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0"
 export PANGO_LIBDIR="$bundle_lib"
 export PANGO_SYSCONFDIR="$bundle_etc"
diff --git a/osx/scripts/make-bundle b/osx/scripts/make-bundle
index 2936e9a..d639ca7 100755
--- a/osx/scripts/make-bundle
+++ b/osx/scripts/make-bundle
@@ -56,8 +56,25 @@ class Application:
                 self._pkg_cache[cachename] = out
 
                 return out
-            else:
-                return self.variables[x.group(1)]
+            
+            m = re.match('^pkg-root:([^:]+)$', x.group(1))
+
+            if m:
+                paths = []
+
+                if 'PKG_CONFIG_PATH' in os.environ:
+                    paths.extend(os.environ['PKG_CONFIG_PATH'].split(':'))
+
+                paths.extend(subprocess.Popen(['pkg-config', '--variable', 'pc_path', 'pkg-config'], 
stdout=subprocess.PIPE).communicate()[0].strip().split(':'))
+
+                for path in paths:
+                    if os.path.isfile(os.path.join(path, m.group(1) + '.pc')):
+                        return os.path.dirname(os.path.dirname(path))
+
+                sys.stderr.write('Warning: failed to find package ' + m.group(1) + '\n')
+                return s
+            
+            return self.variables[x.group(1)]
 
         return re.sub("\\${([^}]+)}", replace, s)
 
@@ -192,6 +209,15 @@ class Application:
 
             target = items[k]
 
+            if isinstance(target, dict) and 'files' in target and 'target' in target:
+                newfiles = []
+
+                for f in files:
+                    newfiles.extend([os.path.join(f, x) for x in target['files']])
+                
+                files = newfiles
+                target = target['target']
+
             if not isinstance(target, list):
                 target = [target]
 
@@ -250,6 +276,25 @@ class Application:
         with open(os.path.join(self.variables['lib'], target_moduledir, 'loaders.cache'), 'w') as f:
             f.write(cache)
 
+    def glib_compile_schemas(self):
+        subprocess.call(['glib-compile-schemas', os.path.join(self.variables['resources'], 'share', 
'glib-2.0', 'schemas')])
+
+    def copy_schemas(self, schemas):
+        if not schemas:
+            return
+
+        self.copy_glob(schemas, application.copy_data)
+        self.glib_compile_schemas()
+
+    def copy_icon_themes(self, themes):
+        if not themes:
+            return
+
+        self.copy_glob(themes, application.copy_data)
+
+        for theme_path in themes.values():
+            subprocess.call(['gtk3-update-icon-cache', '-f', '-t', '--quiet', self.repl(theme_path)])
+
 bundle = json.load(open(args.bundle, 'r'))
 
 # Create the framework
@@ -270,6 +315,12 @@ application.copy_glob(bundle['data'], application.copy_data)
 # Copy data interpolated
 application.copy_glob(bundle['data_interpolated'], application.copy_data_interpolated)
 
+# Compile glib schemas
+application.copy_schemas(bundle['schemas'])
+
+# Compile icon themes
+application.copy_icon_themes(bundle['icon-themes'])
+
 # # Copy scripts
 # framework.copy_glob(config['scripts'], framework.copy_script)
 


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