Gentoo Archives: gentoo-commits

From: Alexandre Restovtsev <tetromino@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:master commit in: dev-libs/gjs/, dev-libs/gjs/files/
Date: Sat, 30 Jul 2011 04:22:07
Message-Id: ef78f21676c04c5d86b962071eba1f84b0a30883.tetromino@gentoo
1 commit: ef78f21676c04c5d86b962071eba1f84b0a30883
2 Author: Alexandre Rostovtsev <tetromino <AT> gmail <DOT> com>
3 AuthorDate: Sat Jul 30 01:04:32 2011 +0000
4 Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com>
5 CommitDate: Sat Jul 30 04:13:45 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=ef78f216
7
8 dev-libs/gjs: add gjs-0.7.14-r1 with optional spidermonkey support
9
10 Port the changes from gnome-next branch to enable gjs to build with
11 either xulrunner-2 or spidermonkey-1.8.5. Required creating a patch
12 that backports the relevant improvements that exist in upstream git
13 master's configure. Builds and passes tests with either choice of
14 javascript engine.
15
16 Note: the commits taken from upstream git keep on rewriting the same
17 region of configure script, removing or altering the effect of previous
18 changes. Therefore, the patch is provided in squashed form, both to use
19 less space, and to make it much easier for an outsider to see what it
20 has actually changed in the 0.7.14 code.
21
22 ---
23 dev-libs/gjs/files/gjs-0.7.14-sanity.patch | 485 ++++++++++++++++++++++++++++
24 dev-libs/gjs/gjs-0.7.14-r1.ebuild | 77 +++++
25 2 files changed, 562 insertions(+), 0 deletions(-)
26
27 diff --git a/dev-libs/gjs/files/gjs-0.7.14-sanity.patch b/dev-libs/gjs/files/gjs-0.7.14-sanity.patch
28 new file mode 100644
29 index 0000000..7b37d64
30 --- /dev/null
31 +++ b/dev-libs/gjs/files/gjs-0.7.14-sanity.patch
32 @@ -0,0 +1,485 @@
33 +This is a combination of 9 squashed commits (squashed to save space, since
34 +the patches keep on modifying the same region of code) and a bit of manual
35 +backporting work, bringing sanity wrt xulrunner and spidermonkey handling to
36 +gjs-0.7.14's configure, and allowing gjs-0.7.14 to correctly build against
37 +spidermonkey-1.8.5.
38 +
39 +The patches squashed (along with their commit messages) are the following:
40 +
41 +1. Marc-Antoine Perennou <Marc-Antoine@××××××××.com> 2011-04-01 14:55:43
42 +Conditionally adapt to JS_CLASS_TRACE removal
43 +
44 +Upstream removed it in http://hg.mozilla.org/mozilla-central/rev/a7784d11c59b
45 +
46 +https://bugzilla.gnome.org/show_bug.cgi?id=646471
47 +
48 +2. Marc-Antoine Perennou <Marc-Antoine@××××××××.com> 2011-04-01 15:04:57
49 +Conditionally adapt to JS_DestroyScript removal
50 +
51 +Upstream changed the behaviour of several things about JSScripts in
52 +http://hg.mozilla.org/mozilla-central/rev/c919a7271ac1
53 +
54 +We now have to use a JSObject instead of a JSScript in certain circumstances,
55 +and we no longer have to call JS_DestroyScript which no longer exists
56 +
57 +https://bugzilla.gnome.org/show_bug.cgi?id=646471
58 +
59 +3. Marc-Antoine Perennou <Marc-Antoine@××××××××.com> 2011-04-28 19:01:03
60 +conditonally adapt to JS_BufferIsCompilableUnit changes
61 +
62 +Upstream added an argument to JS_BufferIsCompilableUnit in commit
63 +http://hg.mozilla.org/mozilla-central/rev/a773890b676f
64 +We now have to tell if the bytes are utf8 or not.
65 +
66 +https://bugzilla.gnome.org/show_bug.cgi?id=646471
67 +
68 +4. Colin Walters <walters@××××××.org> 2011-05-04 14:14:18
69 +Support compilation with standalone mozjs185 release
70 +
71 +Adjust the detection logic so that we look for mozjs-185.pc first. If
72 +we have this, we can skip all kinds of insanity.
73 +
74 +See https://bugzilla.mozilla.org/show_bug.cgi?id=628723
75 +for the discussion about creating this release.
76 +
77 +https://bugzilla.gnome.org/show_bug.cgi?id=646369
78 +
79 +5. Colin Walters <walters@××××××.org> 2011-05-05 12:49:09
80 +JS_CLASS_TRACE is a preprocessor macro, can't use AC_CHECK_LIB
81 +
82 +6. Nirbheek Chauhan <nirbheek@g.o> 2011-05-05 19:23:27
83 +build: drop js-config support, xulrunner-1.8/1.9 cruft, etc
84 +
85 +* The last working version of mozjs/xulrunner is 1.9.2.x, so drop support for
86 + everything before that.
87 +* Spidermonkey got a pkg-config file (gnome bug 646369), so we can get rid of
88 + js-config script support.
89 +* Use AC_CHECK_FUNC instead of AC_CHECK_LIB, which avoids having to guess the
90 + spidermonkey library name, and is the "preferred" way according to
91 + gnome bug 646369#c3.
92 +
93 +https://bugzilla.gnome.org/show_bug.cgi?id=644971
94 +
95 +7. Nirbheek Chauhan <nirbheek@g.o> 2011-05-16 17:44:30
96 +build: pick up the JS library from pkg-config instead of the system one
97 +
98 +Add JS_LIBS to gjs_console_LDADD so that the JS library in libdir from
99 +pkg-config is picked up first instead of the library in /usr/lib which may be
100 +from a system install of an older spidermonkey.
101 +
102 +https://bugzilla.gnome.org/show_bug.cgi?id=644971
103 +
104 +8. Colin Walters <walters@××××××.org> 2011-06-09 13:41:14
105 +Don't set rpath if we're using the standalone libmozjs185
106 +
107 +If we set an rpath to $prefix/lib, this causes us to prefer installed
108 +libraries over the just-built ones, effectively subverting the ability
109 +to run uninstalled.
110 +
111 +9. Alexandre Rostovtsev <tetromino@×××××.com> 2011-07-28 03:40:49
112 +Make choice of javascript package non-automagic
113 +
114 +Add a --with-js-package configure flag to allow selecting which
115 +javascript package to build against, e.g. to force building against
116 +xulrunner on a system that happens to have spidermonkey installed.
117 +
118 +By default, the behavior is the same as before (first check for
119 +mozjs185, then for mozilla-js).
120 +
121 +https://bugzilla.gnome.org/show_bug.cgi?id=655479
122 +---
123 + Makefile.am | 15 +++-
124 + configure.ac | 228 +++++++++++++++++++++-------------------------
125 + gi/keep-alive.c | 10 ++-
126 + gjs-internals-1.0.pc.in | 5 +-
127 + modules/console.c | 10 ++
128 + 5 files changed, 135 insertions(+), 133 deletions(-)
129 +
130 +diff --git a/Makefile.am b/Makefile.am
131 +index a7ecd84..5d340dd 100644
132 +--- a/Makefile.am
133 ++++ b/Makefile.am
134 +@@ -69,7 +69,10 @@ libgjs_la_CFLAGS = \
135 + libgjs_la_LDFLAGS = \
136 + -export-symbols-regex "^[^_]" -version-info 0:0:0 \
137 + -no-undefined \
138 +- -R $(FIREFOX_JS_LIBDIR) -rdynamic
139 ++ -rdynamic
140 ++if HAVE_FIREFOX_JS_LIBDIR
141 ++libgjs_la_LDFLAGS += -R $(FIREFOX_JS_LIBDIR)
142 ++endif
143 + libgjs_la_LIBADD = \
144 + $(GJS_LIBS)
145 +
146 +@@ -121,9 +124,13 @@ gjs_console_CFLAGS = \
147 + $(AM_CFLAGS) \
148 + $(GOBJECT_CFLAGS)
149 + gjs_console_LDADD = \
150 +- $(GOBJECT_LIBS) \
151 +- libgjs.la
152 +-gjs_console_LDFLAGS = -R $(FIREFOX_JS_LIBDIR) -rdynamic
153 ++ $(JS_LIBS) \
154 ++ $(GOBJECT_LIBS) \
155 ++ libgjs.la
156 ++gjs_console_LDFLAGS = -rdynamic
157 ++if HAVE_FIREFOX_JS_LIBDIR
158 ++gjs_console_LDFLAGS += -R $(FIREFOX_JS_LIBDIR)
159 ++endif
160 + gjs_console_SOURCES = gjs/console.c
161 +
162 + install-exec-hook:
163 +diff --git a/configure.ac b/configure.ac
164 +index d185ba1..3d41ecd 100644
165 +--- a/configure.ac
166 ++++ b/configure.ac
167 +@@ -91,123 +91,100 @@ m4_define(gobject_required_version, 2.18.0)
168 + AC_CHECK_HEADERS([malloc.h])
169 + AC_CHECK_FUNCS(mallinfo)
170 +
171 +-# Look for Spidermonkey. If js-config exists, use that;
172 +-# otherwise we try some pkgconfig files from various distributions.
173 +-
174 +-AC_ARG_VAR([JS_CONFIG], [The js-config program to use])
175 +-if test "$ac_cv_env_JS_CONFIG_set" != "set"; then
176 +- AC_PATH_PROG([JS_CONFIG], [js-config], [])
177 ++AC_ARG_WITH([js-package],
178 ++ AS_HELP_STRING([--with-js-package[=@<:@auto/mozjs185/mozilla-js@:>@]],
179 ++ [Choose JavaScript package: 'mozjs185' (i.e. spidermonkey), 'mozilla-js' (i.e. xulrunner or firefox), or 'auto' (detect automatically)]),
180 ++ [with_js_package=$withval],
181 ++ [with_js_package="auto"])
182 ++
183 ++# First, try separate mozjs185 release
184 ++if test $with_js_package = mozjs185 -o $with_js_package = auto; then
185 ++ AC_MSG_CHECKING([for standalone mozjs185])
186 ++ PKG_CHECK_EXISTS([mozjs185], JS_PACKAGE=mozjs185,)
187 ++ if test x$JS_PACKAGE != x; then
188 ++ FIREFOX_JS_LIBDIR=
189 ++ MOZJS_IS_STANDALONE=yes
190 ++ AC_MSG_RESULT([yes])
191 ++ PKG_CHECK_MODULES(JS, $JS_PACKAGE)
192 ++ else
193 ++ AC_MSG_RESULT([no])
194 ++ fi
195 + fi
196 +
197 +-if test -n "$JS_CONFIG"; then
198 +- JS_CFLAGS="$($JS_CONFIG --cflags)"
199 +- JS_LIBS="$($JS_CONFIG --libs)"
200 +- FIREFOX_JS_LIBDIR="$($JS_CONFIG --libdir)"
201 +- JS_PACKAGE=
202 +-
203 +- # js-config gives almost usable CFLAGS, we must define one of XP_BEOS,
204 +- # XP_OS2, XP_WIN or XP_UNIX
205 +- JS_CFLAGS="$JS_CFLAGS -DXP_UNIX"
206 +-else
207 +- ## spidermonkey .pc file name varies across distributions and Gecko version
208 +- ##
209 +- ## mozilla-js: Gecko 1.9, all distributions
210 +- ## xulrunner-js: Gecko 1.8 (and earlier?) Debian/Ubuntu
211 +- ## firefox-js: ???
212 +- ##
213 +- ## Checking for mozilla-js first will hopefully get us the newest version
214 +- ## of spidermonkey.
215 +- PKG_CHECK_EXISTS([mozilla-js], [JS_PACKAGE=mozilla-js],
216 +- [PKG_CHECK_EXISTS([xulrunner-js], [JS_PACKAGE=xulrunner-js], [JS_PACKAGE=firefox-js])])
217 +-
218 +- PKG_CHECK_MODULES(JS, $JS_PACKAGE)
219 +-
220 +- ## some flavors of Firefox .pc only set sdkdir, not libdir
221 +- FIREFOX_JS_SDKDIR=`$PKG_CONFIG --variable=sdkdir $JS_PACKAGE`
222 +- FIREFOX_JS_LIBDIR=`$PKG_CONFIG --variable=libdir $JS_PACKAGE`
223 +-
224 +- ## Ubuntu does not set libdir in mozilla-js.pc
225 +- if test x"$FIREFOX_JS_LIBDIR" = x ; then
226 +- ## Ubuntu returns xulrunner-devel as the sdkdir, but for the
227 +- ## libdir we want the runtime location on the target system,
228 +- ## so can't use -devel.
229 +- ## The library is in the non-devel directory also.
230 +- ## Don't ask me why it's in two places.
231 +- FIREFOX_JS_LIBDIR=`echo "$FIREFOX_JS_SDKDIR" | sed -e 's/-devel//g'`
232 +-
233 +- if ! test -d "$FIREFOX_JS_LIBDIR" ; then
234 +- FIREFOX_JS_LIBDIR=
235 +- fi
236 ++if test $with_js_package = mozilla-js -o $with_js_package = auto; then
237 ++ # If we didn't find mozjs185 (the standalone spidermonkey), look for mozilla-js
238 ++ if test x$JS_PACKAGE = x; then
239 ++ AC_MSG_CHECKING([for mozilla-js 1.9.2])
240 ++ PKG_CHECK_EXISTS([mozilla-js >= 1.9.2], JS_PACKAGE=mozilla-js,)
241 ++ if test x$JS_PACKAGE != x; then
242 ++ AC_MSG_RESULT([yes])
243 ++ else
244 ++ AC_MSG_ERROR([Could not find mozilla-js 1.9.2])
245 ++ fi
246 ++
247 ++ PKG_CHECK_MODULES(JS, $JS_PACKAGE)
248 ++
249 ++ ## some flavors of Firefox .pc only set sdkdir, not libdir
250 ++ FIREFOX_JS_SDKDIR=`$PKG_CONFIG --variable=sdkdir $JS_PACKAGE`
251 ++ FIREFOX_JS_LIBDIR=`$PKG_CONFIG --variable=libdir $JS_PACKAGE`
252 ++
253 ++ ## Ubuntu does not set libdir in mozilla-js.pc
254 ++ if test x"$FIREFOX_JS_LIBDIR" = x; then
255 ++ ## Ubuntu returns xulrunner-devel as the sdkdir, but for the
256 ++ ## libdir we want the runtime location on the target system,
257 ++ ## so can't use -devel.
258 ++ ## The library is in the non-devel directory also.
259 ++ ## Don't ask me why it's in two places.
260 ++ FIREFOX_JS_LIBDIR=`echo "$FIREFOX_JS_SDKDIR" | sed -e 's/-devel//g'`
261 ++ if ! test -d "$FIREFOX_JS_LIBDIR"; then
262 ++ FIREFOX_JS_LIBDIR=
263 ++ fi
264 ++ fi
265 ++
266 ++ if test x"$FIREFOX_JS_LIBDIR" = x; then
267 ++ AC_MSG_ERROR([Could not figure out where the Firefox JavaScript library lives])
268 ++ fi
269 + fi
270 + fi
271 +
272 +-if test x"$FIREFOX_JS_LIBDIR" = x ; then
273 +- AC_MSG_ERROR([Could not figure out where Firefox JavaScript library lives])
274 ++if test x$JS_PACKAGE = x; then
275 ++ AC_MSG_ERROR([No appropriate JavaScript package found])
276 + fi
277 +
278 +-AC_SUBST(JS_PACKAGE)
279 +-AC_SUBST(FIREFOX_JS_LIBDIR)
280 ++echo "Using JS_PACKAGE: $JS_PACKAGE"
281 ++echo "Using JS_CFLAGS: $JS_CFLAGS"
282 ++echo "Using JS_LIBS: $JS_LIBS"
283 +
284 +-AC_MSG_CHECKING([for mozilla-js >= 1.9.2 ])
285 +-if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 1.9.2`; then
286 +- AC_MSG_RESULT([yes])
287 +-else
288 +- AC_MSG_ERROR([$JS_PACKAGE >= 1.9.2 is required])
289 ++AC_SUBST(JS_PACKAGE)
290 ++AM_CONDITIONAL(HAVE_FIREFOX_JS_LIBDIR, test x$FIREFOX_JS_LIBDIR != x)
291 ++if test x$FIREFOX_JS_LIBDIR != x; then
292 ++ GJS_INTERNALS_LIBS="-Wl,--rpath=$FIREFOX_JS_LIBDIR"
293 + fi
294 ++AC_SUBST(GJS_INTERNALS_LIBS)
295 ++AC_SUBST(FIREFOX_JS_LIBDIR)
296 +
297 +-AC_CHECK_LIB([mozjs], [JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),, [$JS_LIBS])
298 +-AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),, [$JS_LIBS])
299 +-AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),, [$JS_LIBS])
300 +-AC_CHECK_LIB([mozjs], [JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTYSTUB], [1], [Define if we have JS_StrictPropertyStub]),, [$JS_LIBS])
301 +-AC_CHECK_LIB([mozjs], [JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),, [$JS_LIBS])
302 ++saved_CFLAGS=$CFLAGS
303 ++saved_LIBS=$LIBS
304 ++CFLAGS=$JS_CFLAGS
305 ++LIBS=$JS_LIBS
306 ++AC_CHECK_FUNC([JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),)
307 ++AC_CHECK_FUNC([JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),)
308 ++AC_CHECK_FUNC([JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),)
309 ++AC_CHECK_FUNC([JS_StrictPropertyStub], AC_DEFINE([HAVE_JS_STRICTPROPERTYSTUB], [1], [Define if we have JS_StrictPropertyStub]),)
310 ++AC_CHECK_FUNC([JS_GetGlobalForScopeChain], AC_DEFINE([HAVE_JS_GETGLOBALFORSCOPECHAIN], [1], [Define if we have JS_GetGlobalForScopeChain]),)
311 ++AC_CHECK_FUNC([JS_DestroyScript], AC_DEFINE([HAVE_JS_DESTROYSCRIPT], [1], [Define if we still have JS_DestroyScript]),)
312 ++AC_CHECK_FUNC([JS_DecodeUTF8], AC_DEFINE([HAVE_JS_DECODEUTF8], [1], [Define if we have JS_DecodeUTF8]),)
313 ++AC_CHECK_FUNC([JS_FreezeObject], AC_DEFINE([HAVE_JS_FREEZEOBJECT], [1], [Define if we have JS_FreezeObject]),)
314 ++AC_CHECK_FUNC([JS_IsScriptFrame], AC_DEFINE([HAVE_JS_ISSCRIPTFRAME], [1], [Define if we have JS_IsScriptFrame]),)
315 ++AC_CHECK_FUNC([JS_EndPC], AC_DEFINE([HAVE_JS_ENDPC], [1], [Define if we have JS_EndPC]),)
316 ++AC_CHECK_FUNC([JS_NewCompartmentAndGlobalObject], AC_DEFINE([HAVE_JS_NEWCOMPARTMENTANDGLOBALOBJECT], [1], [Define if we have JS_NewCompartmentAndGlobalObject]),)
317 ++CFLAGS=$saved_CFLAGS
318 ++LIBS=$saved_LIBS
319 +
320 +-AC_MSG_CHECKING([for mozilla-js >= 2 ])
321 +-if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
322 +- AC_MSG_RESULT([yes])
323 ++if test x$MOZJS_IS_STANDALONE = xyes || `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
324 + AC_DEFINE(HAVE_MOZJS_2, [1], [Define if mozilla-js is at least 2])
325 +- AC_CHECK_LIB([mozjs], [JS_FreezeObject], AC_DEFINE([HAVE_JS_FREEZEOBJECT], [1], [Define if we have JS_FreezeObject]),
326 +- , [$JS_LIBS])
327 +- AC_CHECK_LIB([mozjs], [JS_IsScriptFrame], AC_DEFINE([HAVE_JS_ISSCRIPTFRAME], [1], [Define if we have JS_IsScriptFrame]),
328 +- , [$JS_LIBS])
329 +- AC_CHECK_LIB([mozjs], [JS_EndPC], AC_DEFINE([HAVE_JS_ENDPC], [1], [Define if we have JS_EndPC]),
330 +- , [$JS_LIBS])
331 +- AC_CHECK_LIB([mozjs], [JS_NewCompartmentAndGlobalObject],
332 +- AC_DEFINE([HAVE_JS_NEWCOMPARTMENTANDGLOBALOBJECT], [1], [Define if we have JS_NewCompartmentAndGlobalObject]),
333 +- , [$JS_LIBS])
334 +-
335 +-else
336 +- AC_MSG_RESULT([no])
337 + fi
338 +
339 +-## workaround for Ubuntu Hardy bug where mozilla-js.pc gives CFLAGS
340 +-## -I.../stable while jsapi.h is in .../unstable
341 +-AC_MSG_CHECKING([if SpiderMonkey needs extra compiler flags])
342 +-save_CFLAGS="$CFLAGS"
343 +-CFLAGS="$CFLAGS $JS_CFLAGS"
344 +-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <jsapi.h>]])],
345 +- [js_extra_cflags_needed=no],
346 +- [js_extra_cflags_needed=yes])
347 +-CFLAGS="$save_CFLAGS"
348 +-AC_MSG_RESULT([$js_extra_cflags_needed])
349 +-
350 +-JS_EXTRA_CFLAGS=
351 +-if test "$js_extra_cflags_needed" = yes; then
352 +- try_cflags="-I`$PKG_CONFIG --variable=includedir $JS_PACKAGE`/unstable"
353 +- AC_MSG_CHECKING([if $try_cflags works])
354 +- save_CFLAGS="$CFLAGS"
355 +- CFLAGS="$CFLAGS $JS_CFLAGS $try_cflags"
356 +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <jsapi.h>]])],
357 +- [AC_MSG_RESULT([yes])
358 +- JS_EXTRA_CFLAGS="$try_cflags"],
359 +- [AC_MSG_RESULT([no])])
360 +- CFLAGS="$save_CFLAGS"
361 +-
362 +- if test x"$JS_EXTRA_CFLAGS" = x; then
363 +- AC_MSG_ERROR([Unable to determine extra compiler flags needed])
364 +- fi
365 +-fi
366 +-AC_SUBST([JS_EXTRA_CFLAGS])
367 +-
368 + AC_MSG_CHECKING([whether JSLocaleToUnicode takes a const char*])
369 + save_CFLAGS="$CFLAGS"
370 + CFLAGS="$CFLAGS $JS_CFLAGS -Wno-unused -Werror"
371 +@@ -228,6 +205,30 @@ if test "$have_jslocale_to_unicode_const" = yes; then
372 + AC_DEFINE([JS_LOCALETOUNICODE_NEEDS_CONST_CHAR], [1], [Define if JSLocaleToUnicode takes a const char* for its src])
373 + fi
374 +
375 ++save_CFLAGS="$CFLAGS"
376 ++CFLAGS="$CFLAGS $JS_CFLAGS"
377 ++AC_MSG_CHECKING([for JS_CLASS_TRACE macro])
378 ++AC_COMPILE_IFELSE(
379 ++ [AC_LANG_PROGRAM(
380 ++ [[
381 ++ #include <jsapi.h>
382 ++ #ifndef JS_CLASS_TRACE
383 ++ #error "No JS_CLASS_TRACE"
384 ++ #endif
385 ++ ]],
386 ++ [[(void) 0;]]
387 ++ )],
388 ++ [have_js_class_trace=yes],
389 ++ [have_js_class_trace=no])
390 ++
391 ++if test "x$have_js_class_trace" = xyes; then
392 ++ AC_MSG_RESULT([yes])
393 ++ AC_DEFINE([HAVE_JS_CLASS_TRACE], [1], [Define if we still have JS_CLASS_TRACE])
394 ++else
395 ++ AC_MSG_RESULT([no])
396 ++fi
397 ++CFLAGS="$save_CFLAGS"
398 ++
399 + common_packages="gobject-2.0 >= gobject_required_version $JS_PACKAGE"
400 + gjs_packages="gmodule-2.0 gthread-2.0 $common_packages"
401 + gjs_gi_packages="gobject-introspection-1.0 >= 0.10.1 $common_packages"
402 +@@ -258,27 +259,6 @@ PKG_CHECK_MODULES([GJSTESTS], [$gjstests_packages])
403 + GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
404 + AC_SUBST(GI_DATADIR)
405 +
406 +-if test x"$JS_PACKAGE" = x; then
407 +- # if JS_PACKAGE is undefined, pkg-config modules don't include
408 +- # SpiderMonkey and we need to deal with it ourselves
409 +- GJS_CFLAGS="$GJS_CFLAGS $JS_CFLAGS"
410 +- GJS_LIBS="$GJS_LIBS $JS_LIBS"
411 +- GJS_GI_CFLAGS="$GJS_GI_CFLAGS $JS_CFLAGS"
412 +- GJS_GI_LIBS="$GJS_GI_LIBS $JS_LIBS"
413 +- GJS_CAIRO_CFLAGS="$GJS_CAIRO_CFLAGS $JS_CFLAGS"
414 +- GJS_CAIRO_LIBS="$GJS_CAIRO_LIBS $JS_LIBS"
415 +- GJS_DBUS_CFLAGS="$GJS_DBUS_CFLAGS $JS_CFLAGS"
416 +- GJS_DBUS_LIBS="$GJS_DBUS_LIBS $JS_LIBS"
417 +- GJSTESTS_CFLAGS="$GJSTESTS_CFLAGS $JS_CFLAGS"
418 +- GJSTESTS_LIBS="$GJSTEST_LIBS $JS_LIBS"
419 +-fi
420 +-
421 +-GJS_CFLAGS="$GJS_CFLAGS $JS_EXTRA_CFLAGS"
422 +-GJS_GI_CFLAGS="$GJS_GI_CFLAGS $JS_EXTRA_CFLAGS"
423 +-GJS_CAIRO_CFLAGS="$GJS_CAIRO_CFLAGS $JS_EXTRA_CFLAGS"
424 +-GJS_DBUS_CFLAGS="$GJS_DBUS_CFLAGS $JS_EXTRA_CFLAGS"
425 +-GJSTESTS_CFLAGS="$GJSTESTS_CFLAGS $JS_EXTRA_CFLAGS"
426 +-
427 + # readline
428 + LIBS_no_readline=$LIBS
429 +
430 +diff --git a/gi/keep-alive.c b/gi/keep-alive.c
431 +index c7149ac..e268eaf 100644
432 +--- a/gi/keep-alive.c
433 ++++ b/gi/keep-alive.c
434 +@@ -184,8 +184,10 @@ keep_alive_trace(JSTracer *tracer,
435 + */
436 + static struct JSClass gjs_keep_alive_class = {
437 + "__private_GjsKeepAlive", /* means "new __private_GjsKeepAlive()" works */
438 +- JSCLASS_HAS_PRIVATE |
439 +- JSCLASS_MARK_IS_TRACE, /* TraceOp not MarkOp */
440 ++#ifdef HAVE_JS_CLASS_TRACE
441 ++ JSCLASS_MARK_IS_TRACE | /* TraceOp not MarkOp */
442 ++#endif
443 ++ JSCLASS_HAS_PRIVATE,
444 + JS_PropertyStub,
445 + JS_PropertyStub,
446 + JS_PropertyStub,
447 +@@ -200,7 +202,11 @@ static struct JSClass gjs_keep_alive_class = {
448 + NULL,
449 + NULL,
450 + NULL,
451 ++#ifdef HAVE_JS_CLASS_TRACE
452 + JS_CLASS_TRACE(keep_alive_trace),
453 ++#else
454 ++ keep_alive_trace,
455 ++#endif
456 + NULL
457 + };
458 +
459 +diff --git a/gjs-internals-1.0.pc.in b/gjs-internals-1.0.pc.in
460 +index 701dd42..f4feb19 100644
461 +--- a/gjs-internals-1.0.pc.in
462 ++++ b/gjs-internals-1.0.pc.in
463 +@@ -8,10 +8,9 @@ datadir=@datadir@
464 +
465 + jsdir=@gjsjsdir@
466 + jsnativedir=@gjsnativedir@
467 +-mozjslibdir=@FIREFOX_JS_LIBDIR@
468 +
469 +-Cflags: -I${includedir}/gjs-1.0 @JS_EXTRA_CFLAGS@
470 +-Libs: -Wl,--rpath=${mozjslibdir}
471 ++Cflags: -I${includedir}/gjs-1.0
472 ++Libs: @GJS_INTERNALS_LIBS@
473 + Requires: gjs-1.0 gobject-introspection-1.0 @JS_PACKAGE@
474 +
475 + Name: gjs-internals-1.0
476 +diff --git a/modules/console.c b/modules/console.c
477 +index 49f891b..8e20db3 100644
478 +--- a/modules/console.c
479 ++++ b/modules/console.c
480 +@@ -161,7 +161,11 @@ gjs_console_interact(JSContext *context,
481 + {
482 + JSObject *object = JS_THIS_OBJECT(context, vp);
483 + gboolean eof = FALSE;
484 ++#ifdef HAVE_JS_DESTROYSCRIPT
485 + JSScript *script = NULL;
486 ++#else
487 ++ JSObject *script = NULL;
488 ++#endif
489 + jsval result;
490 + JSString *str;
491 + GString *buffer = NULL;
492 +@@ -192,7 +196,11 @@ gjs_console_interact(JSContext *context,
493 + g_string_append(buffer, temp_buf);
494 + g_free(temp_buf);
495 + lineno++;
496 ++#ifdef HAVE_JS_DECODEUTF8
497 ++ } while (!JS_BufferIsCompilableUnit(context, JS_TRUE, object, buffer->str, buffer->len));
498 ++#else
499 + } while (!JS_BufferIsCompilableUnit(context, object, buffer->str, buffer->len));
500 ++#endif
501 +
502 + script = JS_CompileScript(context, object, buffer->str, buffer->len, "typein",
503 + startline);
504 +@@ -219,8 +227,10 @@ gjs_console_interact(JSContext *context,
505 + }
506 +
507 + next:
508 ++#ifdef HAVE_JS_DESTROYSCRIPT
509 + if (script)
510 + JS_DestroyScript(context, script);
511 ++#endif
512 + g_string_free(buffer, TRUE);
513 + } while (!eof);
514 +
515 +--
516 +1.7.6
517 +
518
519 diff --git a/dev-libs/gjs/gjs-0.7.14-r1.ebuild b/dev-libs/gjs/gjs-0.7.14-r1.ebuild
520 new file mode 100644
521 index 0000000..75c4e04
522 --- /dev/null
523 +++ b/dev-libs/gjs/gjs-0.7.14-r1.ebuild
524 @@ -0,0 +1,77 @@
525 +# Copyright 1999-2011 Gentoo Foundation
526 +# Distributed under the terms of the GNU General Public License v2
527 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/gjs/gjs-0.7.14.ebuild,v 1.2 2011/05/01 15:42:03 nirbheek Exp $
528 +
529 +EAPI="3"
530 +GCONF_DEBUG="no"
531 +GNOME2_LA_PUNT="yes"
532 +PYTHON_DEPEND="2"
533 +
534 +inherit autotools eutils gnome2 python virtualx
535 +
536 +DESCRIPTION="Javascript bindings for GNOME"
537 +HOMEPAGE="http://live.gnome.org/Gjs"
538 +
539 +LICENSE="MIT MPL-1.1 LGPL-2 GPL-2"
540 +SLOT="0"
541 +IUSE="examples test +xulrunner"
542 +KEYWORDS="~amd64 ~x86"
543 +
544 +# Things are untested and broken with anything other than xulrunner-2.0
545 +# FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=628723 instead of libxul
546 +RDEPEND=">=dev-libs/glib-2.18:2
547 + >=dev-libs/gobject-introspection-0.10.1
548 + >=net-libs/xulrunner-2.0:1.9
549 +
550 + dev-libs/dbus-glib
551 + sys-libs/readline
552 + x11-libs/cairo
553 + xulrunner? (
554 + >=net-libs/xulrunner-2.0:1.9
555 + !=dev-lang/spidermonkey-1.8.2* )
556 + !xulrunner? ( =dev-lang/spidermonkey-1.8.5* )"
557 +DEPEND="${RDEPEND}
558 + sys-devel/gettext
559 + >=dev-util/pkgconfig-0.9"
560 +# HACK HACK: gjs-tests picks up /usr/lib/libmozjs.so with spidermonkey installed
561 +
562 +src_prepare() {
563 + # AUTHORS, ChangeLog are empty
564 + DOCS="NEWS README"
565 + # FIXME: add systemtap/dtrace support, like in glib:2
566 + # XXX: Do NOT enable coverage, completely useless for portage installs
567 + G2CONF="${G2CONF}
568 + --disable-systemtap
569 + --disable-dtrace
570 + --disable-coverage"
571 + if use xulrunner; then
572 + G2CONF="${G2CONF} --with-js-package=mozilla-js"
573 + else
574 + G2CONF="${G2CONF} --with-js-package=mozjs185"
575 + fi
576 +
577 + # https://bugzilla.gnome.org/show_bug.cgi?id=646369
578 + # https://bugs.gentoo.org/353941
579 + # https://bugzilla.gnome.org/show_bug.cgi?id=655479
580 + epatch "${FILESDIR}/${P}-sanity.patch"
581 +
582 + eautoreconf
583 +
584 + gnome2_src_prepare
585 + python_convert_shebangs 2 "${S}"/scripts/make-tests
586 +}
587 +
588 +src_test() {
589 + # Tests need dbus
590 + Xemake check || die
591 +}
592 +
593 +src_install() {
594 + # installation sometimes fails in parallel
595 + gnome2_src_install -j1
596 +
597 + if use examples; then
598 + insinto /usr/share/doc/${PF}/examples
599 + doins "${S}"/examples/* || die "doins examples failed!"
600 + fi
601 +}