Add a configure option --enable-jhbuild-wrapper-script

The current gnome-shell.in script has a huge amount of
unnecessary complexity for the installed, normal case.  Fix
this by adding a configure option (defaulting to false) that
installs a simple, obvious wrapper script around mutter.

We do change the gnome-shell build setup to pass this option
by default for jhbuild.

https://bugzilla.gnome.org/show_bug.cgi?id=642084
This commit is contained in:
Colin Walters 2011-02-17 17:07:13 -05:00
parent 70fbfea5f5
commit 7fc6a3670c
6 changed files with 95 additions and 46 deletions

3
.gitignore vendored
View File

@ -42,6 +42,9 @@ src/Makefile
src/Makefile.in
src/gnomeshell-taskpanel
src/gnome-shell
src/gnome-shell-extension-tool
src/gnome-shell-installed
src/gnome-shell-jhbuild
src/run-js-test
src/test-recorder
src/test-recorder.ogg

View File

@ -187,6 +187,24 @@ if test "$enable_compile_warnings" != no ; then
fi
changequote([,])dnl
AC_ARG_ENABLE(jhbuild-wrapper-script,
AS_HELP_STRING([--jhbuild-wrapper-script=yes],[Make "gnome-shell" script work for jhbuild]),,enable_jhbuild_wrapper_script=no)
AM_CONDITIONAL(USE_JHBUILD_WRAPPER_SCRIPT, test "x$enable_jhbuild_wrapper_script" = xyes)
AC_MSG_CHECKING([for Ubuntu])
if test -f /etc/ubuntu_version; then
enable_dynamic_mozjs_hack_default=yes
AC_MSG_RESULT([yes])
else
enable_dynamic_mozjs_hack_default=no
AC_MSG_RESULT([no])
fi
AC_ARG_ENABLE(dynamic-mozjs-hack,
AS_HELP_STRING([--dynamic-mozjs-hack=no],[Look for libmozjs.so using pkg-config]),,enable_dynamic_mozjs_hack=$enable_dynamic_mozjs_hack_default)
ENABLE_DYNAMIC_MOZJS_HACK=$enable_dynamic_mozjs_hack
AC_SUBST(ENABLE_DYNAMIC_MOZJS_HACK)
AC_PATH_PROG(mutter, [mutter])
AC_SUBST(mutter)

View File

@ -2,32 +2,44 @@ NULL =
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
bin_SCRIPTS =
libexec_PROGRAMS =
noinst_LTLIBRARIES =
noinst_PROGRAMS =
.AUTOPARALLEL:
generated_bin_scripts = gnome-shell gnome-shell-extension-tool
bin_SCRIPTS = $(generated_bin_scripts)
generated_bin_scripts = gnome-shell-installed gnome-shell-jhbuild gnome-shell-extension-tool
bin_SCRIPTS += gnome-shell $(generated_bin_scripts)
generated_script_substitutions = -e "s|@MUTTER_BIN_DIR[@]|$(MUTTER_BIN_DIR)|" \
-e "s|@datadir[@]|$(datadir)|" \
-e "s|@libexecdir[@]|$(libexecdir)|" \
-e "s|@libdir[@]|$(libdir)|" \
-e "s|@pkgdatadir[@]|$(pkgdatadir)|" \
-e "s|@ENABLE_DYNAMIC_MOZJS_HACK[@]|$(ENABLE_DYNAMIC_MOZJS_HACK)|" \
-e "s|@PYTHON[@]|$(PYTHON)|" \
-e "s|@VERSION[@]|$(VERSION)|" \
-e "s|@sysconfdir[@]|$(sysconfdir)|"
gnome-shell: gnome-shell.in
gnome-shell-jhbuild: gnome-shell-jhbuild.in Makefile
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
gnome-shell-extension-tool: gnome-shell-extension-tool.in
gnome-shell-installed: gnome-shell-installed.in Makefile
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
CLEANFILES += $(generated_bin_scripts)
gnome-shell-extension-tool: gnome-shell-extension-tool.in Makefile
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
if USE_JHBUILD_WRAPPER_SCRIPT
gnome-shell: gnome-shell-jhbuild Makefile
cp $< $@.tmp && mv $@.tmp $@
else
gnome-shell: gnome-shell-installed Makefile
cp $< $@.tmp && mv $@.tmp $@
endif
CLEANFILES += gnome-shell $(generated_bin_scripts)
EXTRA_DIST += $(generated_bin_scripts:=.in)
include Makefile-gdmuser.am

View File

@ -0,0 +1,41 @@
#!/bin/bash
# gnome-shell is a plugin for mutter; start mutter with the right
# options.
# About the value of NO_GAIL and NO_AT_BRIDGE: If a11y is enabled,
# gtk_init() will normally load gail and at-bridge. But we don't
# want at-bridge to be loaded until after clutter is initialized
# (which mutter does after initializing gtk) and we don't want
# gail to be loaded at all. So set these flags. shell_a11y_init()
# will clear them so they don't get passed to gnome-shell's
# children.
export NO_GAIL=1
export NO_AT_BRIDGE=1
# FIXME - Add gjs API to set this stuff and don't depend on the
# environment. These propagate to child processes.
export GJS_DEBUG_OUTPUT='stderr'
# By default only let gjs show errors and things that are explicitly
# logged via log() from javascript
export GJS_DEBUG_TOPICS='JS ERROR;JS LOG'
if test -z "$MUTTER_PLUGINS"; then
MUTTER_PLUGINS=libgnome-shell
fi
# Work around Ubuntu xulrunner bug,
# http://bugzilla.gnome.org/show_bug.cgi?id=573413
if test x@ENABLE_DYNAMIC_MOZJS_HACK@ = xyes; then
sdkdir=$(pkg-config --variable=sdkdir mozilla-js)
if test -n "${sdkdir}"; then
mozjs_libdir=$(echo "$sdkdir" | sed -e s,'-\(sdk\|devel\)',,)
if test -n "$LD_LIBRARY_PATH"; then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$mozjs_libdir
else
LD_LIBRARY_PATH=$mozjs_libdir
fi
export LD_LIBRARY_PATH
fi
fi
exec mutter --mutter-plugins=$MUTTER_PLUGINS "$@"

View File

@ -157,24 +157,18 @@ def start_shell(perf_output=None):
js_dir = os.path.join('@pkgdatadir@', 'js')
# Set up environment
# About the value of NO_GAIL and NO_AT_BRIDGE: If a11y is enabled,
# gtk_init() will normally load gail and at-bridge. But we don't
# want at-bridge to be loaded until after clutter is initialized
# (which mutter does after initializing gtk) and we don't want
# gail to be loaded at all. So set these flags. shell_a11y_init()
# will clear them so they don't get passed to gnome-shell's
# children.
env = dict(os.environ)
# TODO: Fix this, since nothing prevents it from propagating to child
# processes. Why is it even here?
env.update({'GNOME_DISABLE_CRASH_DIALOG' : '1'})
# This stuff should really should only happen when running
# uninstalled, i.e. it should be in the conditional
# below. Otherwise it's just a bad reimplementation of "jhbuild
# run". See bug #642084
env.update({'GNOME_SHELL_JS' : js_dir,
'PATH' : '@MUTTER_BIN_DIR@:' + os.environ.get('PATH', ''),
'XDG_CONFIG_DIRS' : '@sysconfdir@/xdg:' + (os.environ.get('XDG_CONFIG_DIRS') or '/etc/xdg'),
'XDG_DATA_DIRS' : '@datadir@:' + (os.environ.get('XDG_DATA_DIRS') or '/usr/local/share:/usr/share'),
'GNOME_DISABLE_CRASH_DIALOG' : '1',
'NO_GAIL' : '1',
'NO_AT_BRIDGE' : '1'})
'XDG_DATA_DIRS' : '@datadir@:' + (os.environ.get('XDG_DATA_DIRS') or '/usr/local/share:/usr/share')})
if running_from_source_tree:
if os.environ.has_key('GI_TYPELIB_PATH'):
typelib_dir = typelib_dir + ":" + os.environ.get('GI_TYPELIB_PATH')
@ -183,35 +177,14 @@ def start_shell(perf_output=None):
'GI_TYPELIB_PATH' : typelib_dir,
'GSETTINGS_SCHEMA_DIR' : data_dir })
else:
# This is just broken to set in the installed case; see bug #642084
env.update({'GSETTINGS_SCHEMA_DIR' : os.path.join('@datadir@', 'glib-2.0', 'schemas')})
# Also plain broken to set in the normal installed case
jhbuild_gconf_source = os.path.join('@sysconfdir@', 'gconf/2/path.jhbuild')
if os.path.exists(jhbuild_gconf_source):
env['GCONF_DEFAULT_SOURCE_PATH'] = jhbuild_gconf_source
# Work around Ubuntu xulrunner bug,
# http://bugzilla.gnome.org/show_bug.cgi?id=573413
pkgconfig = subprocess.Popen(['pkg-config', '--variable=sdkdir', 'mozilla-js'],
stdout=subprocess.PIPE)
mozjs_sdkdir = pkgconfig.communicate()[0].strip()
pkgconfig.wait()
if pkgconfig.returncode == 0:
mozjs_libdir = re.sub('-(sdk|devel)', '', mozjs_sdkdir)
if os.path.exists(mozjs_libdir + '/libmozjs.so'):
if 'LD_LIBRARY_PATH' in env and env['LD_LIBRARY_PATH']:
ld_library_path = env['LD_LIBRARY_PATH'] + ':' + mozjs_libdir
else:
ld_library_path = mozjs_libdir
env['LD_LIBRARY_PATH'] = ld_library_path
# Log everything to stderr (make stderr our "log file")
env['GJS_DEBUG_OUTPUT'] = 'stderr'
if not options.verbose:
# Unless verbose() is specified, only let gjs show errors and
# things that are explicitly logged via log() from javascript
env['GJS_DEBUG_TOPICS'] = 'JS ERROR;JS LOG'
if options.perf is not None:
env['SHELL_PERF_MODULE'] = options.perf
@ -223,8 +196,10 @@ def start_shell(perf_output=None):
args = list(debug_command)
else:
args = []
args.extend(['mutter', '--mutter-plugins=' + plugin])
if running_from_source_tree:
env['MUTTER_PLUGINS'] = plugin
args.append(os.path.join(bin_dir, 'gnome-shell-installed'))
if options.replace:
args.append('--replace')
if options.sync:

View File

@ -220,7 +220,7 @@
</dependencies>
</autotools>
<autotools id="gnome-shell">
<autotools id="gnome-shell" autogenargs="--enable-jhbuild-wrapper-script">
<branch repo="git.gnome.org" module="gnome-shell"/>
<dependencies>
<dep package="gobject-introspection"/>