diff options
author | George Hartzell <hartzell@alerce.com> | 2017-04-27 09:04:26 -0700 |
---|---|---|
committer | Adam J. Stewart <ajstewart426@gmail.com> | 2017-04-27 11:04:26 -0500 |
commit | 58567a218273885577a373e6aa8284847203e7d4 (patch) | |
tree | d2dcc6c058d65927086f4cb8ec447adf473af557 /var | |
parent | 41e3e7dbffa5537b684d151e4fe3b96a898a45a6 (diff) | |
download | spack-58567a218273885577a373e6aa8284847203e7d4.tar.gz spack-58567a218273885577a373e6aa8284847203e7d4.tar.bz2 spack-58567a218273885577a373e6aa8284847203e7d4.tar.xz spack-58567a218273885577a373e6aa8284847203e7d4.zip |
Adjustments to get gtkplus to build (#3208)
* Hackery to get gtkplus to build
PR #3077 broke gtkplus by introducing gobject-introspection.
This big hack makes things work. It has problems.
1. Rather than deal with the nasty sbang fooey in the
g-ir-tool-template.in derived scripts, it just adds a python
dependency to each package that runs one of the scripts. This lets
the `/usr/bin/env python` sbang do the right thing.
2. It stuffs a several directories on to the XDG_DATA_DIRS environment
variable, which is used for (among other things) locating the .gir
files.
3. It avoids building the gtkplus demos because I can't make the bit
that calls `gdk-pixbuf-csource` work. It doesn't think that it can
load `.png` files and all of the google hits I found suggest a bad
`loader.cache` file. The file's fine and I can strace the command
and watch it read it in... Many, many hours wasted here.
In spite of the demo failing, the tests pass and an emacs built
with this lib seems to work.
* Fix sbang so everyone needn't depend_on python
Rather than have every package that
`depends_on('gobject-introspection')` also need to
`depend_on('python')`, this commit fixes the
scripts (e.g. `g-ir-scanner`).
The interesting bit is in the gobject-introspection package. There is
a beefy comment there that is included below.
The commit also removes the now un-necessary dependencies from various
packages.
I have two reservations about this commit:
1. How portable is the "insertion" sed command? I'm particularly
worried that some sed's might need the line to insert to be on a
different line, which I can't imagine how to cram into the
Makefile.in.
The solution I see to this is rather than extending the existing
sed command in the Makefile I could shim in another line in the
rule and e.g. call a bit of Perl (or Python, I suppose) which would
end up being much neater.
2. As written it always uses Spack's `.../bin/sbang`, which might or
might not be a good idea.
If I use "the solution" from number 1 above, then I can check the
line length before I munge it. Otherwise???
---
This package creates several scripts from |
toosl/g-ir-tool-template.in. In their original form these |
scripts end up with a sbang line like |
|
`#!/usr/bin/env /path/to/spack/python`. |
|
These scripts are generated and then used as part of the build |
(other packages also use the scripts after they've been |
installed). |
|
The path to the spack python can become too long. Because these |
tools are used as part of the build, the normal hook that fixes |
this problem can't help us. |
This package fixes the problem in two steps: |
- it rewrites the g-ir-tool-template so that its sbang line |
refers directly to spack's python (filter_file step below); and |
- it patches the Makefile.in so that the generated Makefile has an |
extra sed expression in its TOOL_SUBSTITUTION that results in |
an `#!/bin/bash /path/to/spack/bin/sbang` unconditionally being |
inserted into the scripts as they're generated. |
* Cairo needs python when it's +X
Cairo needs to depend_on python when it's +X. I think it's an
indirect requirement that's coming in via libxcb).
* Flake8 cleanup
* Make cairo's dep on python be type=build
This seems to be the right thing and seems to produce a result
that works (I can build gtk+ and then emacs+X on top of it).
Diffstat (limited to 'var')
8 files changed, 67 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/atk/package.py b/var/spack/repos/builtin/packages/atk/package.py index 1375f2d0f9..7605059850 100644 --- a/var/spack/repos/builtin/packages/atk/package.py +++ b/var/spack/repos/builtin/packages/atk/package.py @@ -38,8 +38,13 @@ class Atk(AutotoolsPackage): depends_on('glib') depends_on('pkg-config', type='build') + depends_on('gobject-introspection') def url_for_version(self, version): """Handle atk's version-based custom URLs.""" url = 'http://ftp.gnome.org/pub/gnome/sources/atk' return url + '/%s/atk-%s.tar.xz' % (version.up_to(2), version) + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + spack_env.prepend_path("XDG_DATA_DIRS", + self.prefix.share) diff --git a/var/spack/repos/builtin/packages/cairo/package.py b/var/spack/repos/builtin/packages/cairo/package.py index 9df93ccddb..5d04bf29fa 100644 --- a/var/spack/repos/builtin/packages/cairo/package.py +++ b/var/spack/repos/builtin/packages/cairo/package.py @@ -40,6 +40,7 @@ class Cairo(AutotoolsPackage): depends_on('libxext', when='+X') depends_on('libxrender', when='+X') depends_on('libxcb', when='+X') + depends_on('python', when='+X', type='build') depends_on("libpng") depends_on("glib") depends_on("pixman") diff --git a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py index 2f3a0b0bd7..deb8b77819 100644 --- a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py +++ b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py @@ -44,3 +44,8 @@ class GdkPixbuf(AutotoolsPackage): depends_on("jpeg") depends_on("libpng") depends_on("libtiff") + depends_on("gobject-introspection") + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + spack_env.prepend_path("XDG_DATA_DIRS", + self.prefix.share) diff --git a/var/spack/repos/builtin/packages/gobject-introspection/package.py b/var/spack/repos/builtin/packages/gobject-introspection/package.py index e20688c9e9..5f147cccfc 100644 --- a/var/spack/repos/builtin/packages/gobject-introspection/package.py +++ b/var/spack/repos/builtin/packages/gobject-introspection/package.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +from spack import spack_root class GobjectIntrospection(Package): @@ -44,10 +45,35 @@ class GobjectIntrospection(Package): depends_on("bison", type="build") depends_on("flex", type="build") + # This package creates several scripts from + # toosl/g-ir-tool-template.in. In their original form these + # scripts end up with a sbang line like + # + # `#!/usr/bin/env /path/to/spack/python`. + # + # These scripts are generated and then used as part of the build + # (other packages also use the scripts after they've been + # installed). + # + # The path to the spack python can become too long. Because these + # tools are used as part of the build, the normal hook that fixes + # this problem can't help us. + # This package fixes the problem in two steps: + # - it rewrites the g-ir-tool-template so that its sbang line + # refers directly to spack's python (filter_file step below); and + # - it patches the Makefile.in so that the generated Makefile has an + # extra sed expression in its TOOL_SUBSTITUTION that results in + # an `#!/bin/bash /path/to/spack/bin/sbang` unconditionally being + # inserted into the scripts as they're generated. + patch("sbang.patch") + def install(self, spec, prefix): configure("--prefix=%s" % prefix) # we need to filter this file to avoid an overly long hashbang line - filter_file('@PYTHON@', 'python', + filter_file('#!/usr/bin/env @PYTHON@', '#!@PYTHON@', 'tools/g-ir-tool-template.in') make() make("install") + + def setup_environment(self, spack_env, run_env): + spack_env.set('SPACK_SBANG', "%s/bin/sbang" % spack_root) diff --git a/var/spack/repos/builtin/packages/gobject-introspection/sbang.patch b/var/spack/repos/builtin/packages/gobject-introspection/sbang.patch new file mode 100644 index 0000000000..7d4b78a930 --- /dev/null +++ b/var/spack/repos/builtin/packages/gobject-introspection/sbang.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in 2016-09-13 01:23:59.000000000 -0700 ++++ b/Makefile.in 2017-02-22 10:26:31.824509512 -0800 +@@ -1475,7 +1475,7 @@ + gir_DATA = $(STATIC_GIRSOURCES) $(SUBSTITUTED_GIRSOURCES) $(BUILT_GIRSOURCES) + typelibsdir = $(libdir)/girepository-1.0 + typelibs_DATA = $(gir_DATA:.gir=.typelib) +-TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON\@,$(PYTHON), ++TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON\@,$(PYTHON), -e "1i\#!/bin/bash $(SPACK_SBANG)" + g_ir_compiler_SOURCES = tools/compiler.c + g_ir_compiler_CPPFLAGS = -DGIREPO_DEFAULT_SEARCH_PATH="\"$(libdir)\"" \ + -I$(top_srcdir)/girepository diff --git a/var/spack/repos/builtin/packages/gtkplus/no-demos.patch b/var/spack/repos/builtin/packages/gtkplus/no-demos.patch new file mode 100644 index 0000000000..5acc988c38 --- /dev/null +++ b/var/spack/repos/builtin/packages/gtkplus/no-demos.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in 2017-02-21 12:18:44.774922978 -0800 ++++ b/Makefile.in 2017-02-21 12:18:54.465965697 -0800 +@@ -564,7 +564,7 @@ + || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \ + && DISPLAY=:$$XID && export DISPLAY + +-SRC_SUBDIRS = gdk gtk modules demos tests perf ++SRC_SUBDIRS = gdk gtk modules tests perf + SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build + + # require automake 1.4 diff --git a/var/spack/repos/builtin/packages/gtkplus/package.py b/var/spack/repos/builtin/packages/gtkplus/package.py index 4664cfcbb2..227ecc3e09 100644 --- a/var/spack/repos/builtin/packages/gtkplus/package.py +++ b/var/spack/repos/builtin/packages/gtkplus/package.py @@ -46,6 +46,8 @@ class Gtkplus(AutotoolsPackage): depends_on("pango+X", when='+X') depends_on('gobject-introspection', when='+X') + patch('no-demos.patch') + def patch(self): # remove disable deprecated flag. filter_file(r'CFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CFLAGS"', diff --git a/var/spack/repos/builtin/packages/pango/package.py b/var/spack/repos/builtin/packages/pango/package.py index e5a8e8c57d..3c1c46e64b 100644 --- a/var/spack/repos/builtin/packages/pango/package.py +++ b/var/spack/repos/builtin/packages/pango/package.py @@ -48,6 +48,7 @@ class Pango(AutotoolsPackage): depends_on("cairo+X", when='+X') depends_on("libxft", when='+X') depends_on("glib") + depends_on('gobject-introspection') def configure_args(self): args = [] @@ -59,3 +60,7 @@ class Pango(AutotoolsPackage): def install(self, spec, prefix): make("install", parallel=False) + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + spack_env.prepend_path("XDG_DATA_DIRS", + self.prefix.share) |