Commit 25681375 authored by Colin Walters's avatar Colin Walters

Separate "basic" API from "embedder/module" API

Previously <gjs/gjs.h> pulled in a lot of stuff, and in particular,
<gjs/jsapi-util.h>, which in turn required <jsapi.h>.  For a simple
app that wants to embed GJS we should not be pulling that in.

So <gjs/gjs.h> is now the "simple" API that actually just includes
<gjs/context.h>, suitable for creating a context and calling eval().

<gjs/gjs-module.h> is now equivalent to the old <gjs/gjs.h>, it
pulls in the world.

Also, create a corresponding .pc file, gjs-internals-1.0.pc.  This one
includes mozjs as Requires, and adds the requisite Cflags.  For
gjs-1.0.pc, change the Requires to simply be gobject-2.0.
Conceptually, a gjs-devel RPM should not Require
gobject-introspection-devel or xulrunner-devel, and a simple embedder
program just using gjs_context_new()/gjs_context_eval() should not
have DT_NEEDED on gobject-introspection-1.0.so or mozjs.so.

https://bugzilla.gnome.org/show_bug.cgi?id=632795
parent da877651
......@@ -22,6 +22,7 @@ depcomp
gjs-1.0.pc
gjs-console
gjs-dbus-1.0.pc
gjs-internals-1.0.pc
gjs-gi-1.0.pc
gjs-tests
gjs-unit
......
lib_LTLIBRARIES += libgjs-dbus.la
gjs_dbusheaderdir=$(gjsincludedir)/gjs-dbus
gjs_dbusheaderdir=$(gjs_module_includedir)/gjs-dbus
gjs_dbusheader_HEADERS = \
gjs-dbus/dbus.h \
gjs-dbus/dbus-proxy.h
......
......@@ -15,14 +15,17 @@ gjsjsdir = @gjsjsdir@
gjstweenerdir = @gjsjsdir@/tweener
gjsnativedir = @gjsnativedir@
gjsincludedir = $(includedir)/gjs-1.0
gjs_public_includedir = $(includedir)/gjs-1.0
gjs_module_includedir = $(includedir)/gjs-1.0
########################################################################
nobase_gjsinclude_HEADERS = \
gjs/byteArray.h \
nobase_gjs_public_include_HEADERS = \
gjs/context.h \
gjs/gjs.h
nobase_gjs_module_include_HEADERS = \
gjs/byteArray.h \
gjs/importer.h \
gjs/gjs.h \
gjs/jsapi-util.h \
gjs/mem.h \
gjs/native.h
......@@ -40,10 +43,11 @@ noinst_HEADERS += \
########################################################################
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gjs-1.0.pc
pkgconfig_DATA = gjs-1.0.pc gjs-internals-1.0.pc
EXTRA_DIST += \
gjs-1.0.pc.in
gjs-1.0.pc.in \
gjs-internals-1.0.pc.in
########################################################################
gjs_directory_defines = \
......@@ -116,7 +120,6 @@ gjs_console_CFLAGS = \
$(AM_CFLAGS) \
$(GJS_CFLAGS)
gjs_console_LDADD = \
$(GJS_LIBS) \
libgjs.la
gjs_console_LDFLAGS = -R $(FIREFOX_JS_LIBDIR) -rdynamic
gjs_console_SOURCES = gjs/console.c
......
......@@ -314,5 +314,5 @@ gjsnativedir="\${libdir}/gjs-1.0"
AC_SUBST([gjsjsdir])
AC_SUBST([gjsnativedir])
AC_CONFIG_FILES([Makefile gjs-1.0.pc gjs-gi-1.0.pc gjs-dbus-1.0.pc])
AC_CONFIG_FILES([Makefile gjs-1.0.pc gjs-gi-1.0.pc gjs-dbus-1.0.pc gjs-internals-1.0.pc])
AC_OUTPUT
......@@ -30,7 +30,7 @@
#include "union.h"
#include "value.h"
#include "gjs/byteArray.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -28,7 +28,7 @@
#include "boxed.h"
#include "arg.h"
#include "object.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "repo.h"
#include "function.h"
......
......@@ -29,7 +29,7 @@
#include "closure.h"
#include "keep-alive.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
typedef struct {
......
......@@ -25,7 +25,7 @@
#include <string.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "repo.h"
......
......@@ -24,7 +24,7 @@
#include <config.h>
#include <string.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <girepository.h>
......
......@@ -28,7 +28,7 @@
#include "object.h"
#include "boxed.h"
#include "union.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -25,7 +25,7 @@
#include "keep-alive.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -26,7 +26,7 @@
#include "ns.h"
#include "repo.h"
#include "param.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -33,7 +33,7 @@
#include "keep-alive.h"
#include "gjs_gi_trace.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -27,7 +27,7 @@
#include "param.h"
#include "repo.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -33,14 +33,11 @@
#include "arg.h"
#include "foreign.h"
#include <gjs/mem.h>
#include <gjs/compat.h>
#include <util/log.h>
#include <util/misc.h>
#include <jsapi.h>
#include <girepository.h>
#include <string.h>
......
......@@ -26,11 +26,9 @@
#include <glib.h>
#include <jsapi.h>
#include <girepository.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
G_BEGIN_DECLS
......
......@@ -31,7 +31,7 @@
#include "union.h"
#include "arg.h"
#include "object.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "repo.h"
#include "function.h"
......
......@@ -32,7 +32,7 @@
#include "object.h"
#include "boxed.h"
#include "union.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <girepository.h>
......
......@@ -7,12 +7,10 @@ datarootdir=@datarootdir@
datadir=@datadir@
gjs_console=${bindir}/gjs-console
jsdir=@gjsjsdir@
jsnativedir=@gjsnativedir@
mozjslibdir=@FIREFOX_JS_LIBDIR@
Cflags: -I${includedir}/gjs-1.0 @JS_EXTRA_CFLAGS@
Requires: gobject-introspection-1.0 @JS_PACKAGE@
Cflags: -I${includedir}/gjs-1.0
Requires: gobject-2.0
Requires.private: gobject-introspection-1.0 @JS_PACKAGE@
Libs: -L${libdir} -lgjs
Name: gjs-1.0
......
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=@bindir@
includedir=@includedir@
datarootdir=@datarootdir@
datadir=@datadir@
jsdir=@gjsjsdir@
jsnativedir=@gjsnativedir@
mozjslibdir=@FIREFOX_JS_LIBDIR@
Cflags: -I${includedir}/gjs-1.0 @JS_EXTRA_CFLAGS@
Requires: gjs-1.0 gobject-introspection-1.0 @JS_PACKAGE@
Name: gjs-internals-1.0
Description: Internal API for gjs (for modules and embedders); uses mozjs
Version: @VERSION@
......@@ -25,7 +25,7 @@
#include <string.h>
#include <glib.h>
#include "byteArray.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
#include <jsapi.h>
......
......@@ -27,7 +27,7 @@
#include <locale.h>
#include <util/log.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
static char **include_path = NULL;
......
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/*
* Copyright (c) 2010 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef __GJS_GJS_MODULE_H__
#define __GJS_GJS_MODULE_H__
#include <gjs/gjs.h>
#include <gjs/native.h>
#include <gjs/mem.h>
#include <gjs/importer.h>
#include <gjs/jsapi-util.h>
#endif /* __GJS_GJS_umodule_H__ */
......@@ -25,9 +25,5 @@
#define __GJS_GJS_H__
#include <gjs/context.h>
#include <gjs/importer.h>
#include <gjs/jsapi-util.h>
#include <gjs/native.h>
#include <gjs/mem.h>
#endif /* __GJS_GJS_H__ */
......@@ -26,9 +26,8 @@
#include <util/log.h>
#include <util/glib.h>
#include <jsapi.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/importer.h>
#include <gjs/compat.h>
#include <string.h>
......
......@@ -24,8 +24,8 @@
#ifndef __GJS_IMPORTER_H__
#define __GJS_IMPORTER_H__
#if !defined (__GJS_GJS_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs.h> can be included directly."
#if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs-module.h> can be included directly."
#endif
#include <glib.h>
......
......@@ -24,8 +24,8 @@
#ifndef __GJS_JSAPI_UTIL_H__
#define __GJS_JSAPI_UTIL_H__
#if !defined (__GJS_GJS_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs.h> can be included directly."
#if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs-module.h> can be included directly."
#endif
#include <jsapi.h>
......
......@@ -24,8 +24,8 @@
#ifndef __GJS_MEM_H__
#define __GJS_MEM_H__
#if !defined (__GJS_GJS_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs.h> can be included directly."
#if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs-module.h> can be included directly."
#endif
#include <glib.h>
......
......@@ -24,8 +24,8 @@
#ifndef __GJS_NATIVE_H__
#define __GJS_NATIVE_H__
#if !defined (__GJS_GJS_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs.h> can be included directly."
#if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION)
#error "Only <gjs/gjs-module.h> can be included directly."
#endif
#include <glib.h>
......
......@@ -21,7 +21,7 @@
* IN THE SOFTWARE.
*/
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include "unit-test-utils.h"
static void
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <gi/foreign.h>
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"
......
......@@ -22,7 +22,7 @@
#include <config.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "cairo-private.h"
......
......@@ -52,7 +52,7 @@
#include <jsapi.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "console.h"
......
......@@ -26,7 +26,7 @@
#include "gjs-dbus/dbus.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <util/log.h>
......
......@@ -23,7 +23,7 @@
#include "dbus-values.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <gjs-dbus/dbus.h>
......
......@@ -22,9 +22,8 @@
#ifndef __GJS_JS_DBUS_VALUES_H__
#define __GJS_JS_DBUS_VALUES_H__
#include <glib.h>
#include <dbus/dbus.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
G_BEGIN_DECLS
......
......@@ -25,9 +25,9 @@
#include "dbus-exports.h"
#include "dbus-values.h"
#include "../gjs/gjs.h"
#include "../gjs/compat.h"
#include <gjs/gjs-module.h>
#include "../gi/closure.h"
#include <gjs/compat.h>
#include <util/log.h>
#include <gjs-dbus/dbus.h>
......
......@@ -24,7 +24,7 @@
#include "gettext-native.h"
#include "../gi/closure.h"
#include <util/log.h>
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <jsapi.h>
#include <glib/gi18n.h>
......
......@@ -22,7 +22,7 @@
*/
#include "lang.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include <glib.h>
......
......@@ -22,7 +22,7 @@
*/
#include "mainloop.h"
#include <gjs/gjs.h>
#include <gjs/gjs-module.h>
#include <gjs/compat.h>
#include "../gi/closure.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment