[polari] Use imports.package for bootstrapping



commit 0fecfce0ca95b90fbf1090ce80596fe28cf27464
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 22 22:44:54 2015 +0100

    Use imports.package for bootstrapping
    
    Get rid of your own boilerplate in favor of gjs' package module ...

 src/Makefile.am |    4 +++-
 src/main.js     |    4 ----
 src/polari.in   |   25 +++++--------------------
 3 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 41a7887..e680c6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,8 +15,10 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA)
 
 do_subst = sed -e 's|@localedir[ ]|$(localedir)|g' \
                -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
-               -e 's|@pkglibdir[ ]|$(pkglibdir)|g' \
+               -e 's|@prefix[ ]|$(prefix)|g' \
+               -e 's|@libdir[ ]|$(libdir)|g' \
                -e 's|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|g' \
+               -e 's|@PACKAGE_NAME[ ]|$(PACKAGE_NAME)|g' \
                -e 's|@PACKAGE_VERSION[ ]|$(PACKAGE_VERSION)|g' \
                $(NULL)
 
diff --git a/src/main.js b/src/main.js
index 1081570..c1703e5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,10 +1,6 @@
 const Application = imports.application;
 const GLib = imports.gi.GLib;
 
-function start() {
-    main(ARGV);
-}
-
 function main(args) {
     let application = new Application.Application();
     if (GLib.getenv('POLARI_PERSIST'))
diff --git a/src/polari.in b/src/polari.in
index fa8f7ea..f64d69a 100644
--- a/src/polari.in
+++ b/src/polari.in
@@ -1,20 +1,5 @@
-#!/bin/sh
-
-export GJS_PATH="@pkgdatadir ${GJS_PATH:+:$GJS_PATH}"
-export GI_TYPELIB_PATH="@pkglibdir@/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
-export LD_LIBRARY_PATH="@pkglibdir ${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-
-if test x"$GJS_DEBUG_OUTPUT" = x ; then
-    export GJS_DEBUG_OUTPUT=stderr
-fi
-
-if test x"$GJS_DEBUG_TOPICS" = x ; then
-    export GJS_DEBUG_TOPICS="JS ERROR;JS LOG"
-fi
-
-DEBUG_COMMAND=""
-if test x"$POLARI_RUN_DEBUG" != x; then
-    DEBUG_COMMAND="gdb --args"
-fi
-
-exec $DEBUG_COMMAND @GJS_CONSOLE@ -I @pkgdatadir@ -c "const Main = imports.main; Main.start();" "$@"
+#! GJS_CONSOLE@
+imports.package.start({ name: "@PACKAGE_NAME@",
+                        version: "@PACKAGE_VERSION@",
+                        prefix: "@prefix@",
+                        libdir: "@libdir@" });


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