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/spack/repos/builtin/packages/gobject-introspection | |
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/spack/repos/builtin/packages/gobject-introspection')
-rw-r--r-- | var/spack/repos/builtin/packages/gobject-introspection/package.py | 28 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/gobject-introspection/sbang.patch | 11 |
2 files changed, 38 insertions, 1 deletions
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 |