From 8087e6aee6bcd647de2d57fa695732d999034efa Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 11 Mar 2009 09:59:02 -0400 Subject: [PATCH] make gnome-shell runnable from an install --- configure.ac | 1 - src/Makefile-taskpanel.am | 4 ++-- src/Makefile.am | 18 +++++++++++++---- src/gnome-shell.in | 42 +++++++++++++++++++++++---------------- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index fd36fa1e6..756fb4fa6 100644 --- a/configure.ac +++ b/configure.ac @@ -76,5 +76,4 @@ AC_OUTPUT([ js/Makefile js/ui/Makefile src/Makefile - src/gnome-shell ]) diff --git a/src/Makefile-taskpanel.am b/src/Makefile-taskpanel.am index be1575853..2bdf4e9b0 100644 --- a/src/Makefile-taskpanel.am +++ b/src/Makefile-taskpanel.am @@ -11,7 +11,7 @@ gnomeshell_taskpanel_SOURCES = \ shell-panel-window.c \ shell-panel-window.h \ $(NULL) - + gnomeshell_taskpanel_LDADD = $(TASKPANEL_LIBS) -bin_PROGRAMS += gnomeshell-taskpanel +libexec_PROGRAMS += gnomeshell-taskpanel diff --git a/src/Makefile.am b/src/Makefile.am index d03c4fd02..cc29a833f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,9 +2,22 @@ NULL = BUILT_SOURCES = CLEANFILES = EXTRA_DIST = -bin_PROGRAMS = +libexec_PROGRAMS = noinst_LTLIBRARIES = +bin_SCRIPTS = gnome-shell + +gnome-shell: gnome-shell.in + sed -e "s|@META_BIN_DIR[@]|$(META_BIN_DIR)|" \ + -e "s|@GJS_JS_DIR[@]|$(GJS_JS_DIR)|" \ + -e "s|@GJS_JS_NATIVE_DIR[@]|$(GJS_JS_NATIVE_DIR)|" \ + -e "s|@libexecdir[@]|$(libexecdir)|" \ + -e "s|@libdir[@]|$(libdir)|" \ + -e "s|@pkgdatadir[@]|$(pkgdatadir)|" \ + $< > $@ && chmod a+x $@ +CLEANFILES += gnome-shell +EXTRA_DIST += gnome-shell.in + include Makefile-tidy.am include Makefile-big.am include Makefile-gdmuser.am @@ -147,6 +160,3 @@ CLEANFILES += Big-1.0.gir Big-1.0.typelib: libbig-1.0.la Big-1.0.gir LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. g-ir-compiler Big-1.0.gir -o $@ CLEANFILES += Big-1.0.typelib - -all-local: - chmod a+x gnome-shell diff --git a/src/gnome-shell.in b/src/gnome-shell.in index 2e452d429..abaec6a4a 100755 --- a/src/gnome-shell.in +++ b/src/gnome-shell.in @@ -107,16 +107,33 @@ def _get_glx_extensions(): return (server_glx_extensions, client_glx_extensions, glx_extensions) def start_shell(): - # Figure out the path to the plugin when uninstalled - src_dir = os.path.dirname(os.path.abspath(sys.argv[0])) - top_dir = os.path.dirname(src_dir) - plugin_dir = os.path.join(top_dir, "src") - js_dir = os.path.join(top_dir, "js") - data_dir = os.path.join(top_dir, "data") + bin_dir = os.path.dirname(os.path.abspath(sys.argv[0])) + if os.path.exists(os.path.join(bin_dir, 'gnome-shell.in')): + running_from_source_tree = True + top_dir = os.path.dirname(bin_dir) + plugin_dir = os.path.join(top_dir, "src") + typelib_dir = os.path.join(top_dir, "src") + taskpanel_dir = os.path.join(top_dir, "src") + js_dir = os.path.join(top_dir, "js") + data_dir = os.path.join(top_dir, "data") + else: + running_from_source_tree = False + js_dir = os.path.join('@pkgdatadir@', 'js') + plugin_dir = '@libdir@/metacity/plugins/clutter' + taskpanel_dir = '@libexecdir@' + + # Set up environment + env = dict(os.environ) + env.update({'GNOME_SHELL_JS' : '@GJS_JS_DIR@:@GJS_JS_NATIVE_DIR@:' + js_dir, + 'PATH' : '@META_BIN_DIR@:' + os.environ.get('PATH', '') + ':' + taskpanel_dir, + 'GNOME_DISABLE_CRASH_DIALOG' : '1'}) + + if running_from_source_tree: + env.update({'GNOME_SHELL_DATADIR' : data_dir, + 'GI_TYPELIB_PATH' : typelib_dir}) # Work around Ubuntu xulrunner bug, # http://bugzilla.gnome.org/show_bug.cgi?id=573413 - mozjs_ld_library_path = '' pkgconfig = subprocess.Popen(['pkg-config', '--variable=sdkdir', 'mozilla-js'], stdout=subprocess.PIPE) mozjs_sdkdir = pkgconfig.communicate()[0].strip() @@ -124,16 +141,7 @@ def start_shell(): if pkgconfig.returncode == 0: mozjs_libdir = re.sub('-(sdk|devel)', '', mozjs_sdkdir) if os.path.exists(mozjs_libdir + '/libmozjs.so'): - mozjs_ld_library_path = ':' + mozjs_libdir - - # Set up environment - env = dict(os.environ) - env.update({'GNOME_SHELL_JS' : '@GJS_JS_DIR@:@GJS_JS_NATIVE_DIR@:' + js_dir, - 'GNOME_SHELL_DATADIR' : data_dir, - 'GI_TYPELIB_PATH' : plugin_dir, - 'PATH' : '@META_BIN_DIR@:' + os.environ.get('PATH', '') + ':' + plugin_dir, - 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH', '') + ':' + plugin_dir + mozjs_ld_library_path, - 'GNOME_DISABLE_CRASH_DIALOG' : '1'}) + env['LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '') + ':' + mozjs_libdir if not options.verbose: # Unless verbose() is specified, only let gjs show errors and