[gnome-builder] scripting: make gjs/pygobject optional
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] scripting: make gjs/pygobject optional
- Date: Tue, 1 Sep 2015 08:26:40 +0000 (UTC)
commit 861ac35aa14ebe84a7d7bcf79c65bf93e991b55b
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 1 00:40:18 2015 -0700
scripting: make gjs/pygobject optional
If we fail to locate what we need for gjs or pygobject scripting,
simply report failure to enable those features in configure output.
configure.ac | 36 ++++++++++++++++++++++++++++++------
libide/Makefile.am | 28 ++++++++++++++++++++++------
libide/ide.c | 14 ++++++++++++--
3 files changed, 64 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2f6e11d..29bd26f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,13 @@ PKG_CHECK_MODULES(NAUTILUS, [glib-2.0 >= glib_required_version
gtk+-3.0 >= gtk_required_version])
PKG_CHECK_MODULES(XML, [gio-2.0 >= glib_required_version
libxml-2.0 >= libxml_required_version])
+PKG_CHECK_MODULES(PYGOBJECT,[pygobject-3.0 >= pygobject_required_version],
+ [have_pygobject=yes],
+ [have_pygobject=no])
+PKG_CHECK_MODULES(GJS, [gjs-1.0 >= gjs_required_version
+ gjs-internals-1.0 >= gjs_required_version],
+ [enable_gjs_scripting=yes],
+ [enable_gjs_scripting=no])
dnl ***********************************************************************
@@ -248,13 +255,25 @@ CPPFLAGS=${CPPFLAGS_SAVE}
dnl ***********************************************************************
dnl Check for Required Python
dnl ***********************************************************************
-AC_PATH_TOOL(PYTHON3_CONFIG, "python3-config")
-AS_IF([test -z "${PYTHON3_CONFIG}"],[
- AC_MSG_ERROR([Failed to locate python3-config.])
+enable_python_scripting=no
+AS_IF([test "x$have_pygobject" = "xyes"],[
+ AC_PATH_TOOL(PYTHON3_CONFIG, "python3-config")
+ AS_IF([test -z "${PYTHON3_CONFIG}"],[
+ AC_MSG_RESULT([Failed to locate python3-config.])
+ ],[
+ LIBIDE_CFLAGS="${LIBIDE_CFLAGS} `${PYTHON3_CONFIG} --includes`"
+ LIBIDE_LIBS="${LIBIDE_LIBS} `${PYTHON3_CONFIG} --libs`"
+ LIBIDE_LDFLAGS="${LIBIDE_LDFLAGS} `${PYTHON3_CONFIG} --ldflags`"
+ enable_python_scripting=yes
+ ])
])
-LIBIDE_CFLAGS="${LIBIDE_CFLAGS} `${PYTHON3_CONFIG} --includes`"
-LIBIDE_LIBS="${LIBIDE_LIBS} `${PYTHON3_CONFIG} --libs`"
-LIBIDE_LDFLAGS="${LIBIDE_LDFLAGS} `${PYTHON3_CONFIG} --ldflags`"
+
+
+dnl ***********************************************************************
+dnl Define automake conditionals based on what we found
+dnl ***********************************************************************
+AM_CONDITIONAL(ENABLE_PYTHON_SCRIPTING, test x$enable_python_scripting != xno)
+AM_CONDITIONAL(ENABLE_GJS_SCRIPTING, test x$enable_gjs_scripting != xno)
dnl ***********************************************************************
@@ -500,6 +519,11 @@ echo " Build Test Suite ..................... : ${enable_tests}"
echo " Build API reference .................. : ${enable_gtk_doc}"
echo " Use cross-referencing in API docs .... : ${enable_doc_cross_references}"
echo ""
+echo " Scripting"
+echo ""
+echo " Python ............................... : ${enable_python_scripting}"
+echo " GJS .................................. : ${enable_gjs_scripting}"
+echo ""
echo " Plugins"
echo ""
echo " Autotools ............................ : yes"
diff --git a/libide/Makefile.am b/libide/Makefile.am
index ce9a076..1a89608 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -185,8 +185,6 @@ libide_1_0_la_SOURCES = \
gconstructor.h \
git/ide-git-buffer-change-monitor.c \
git/ide-git-buffer-change-monitor.h \
- gjs/ide-gjs-script.cpp \
- gjs/ide-gjs-script.h \
gsettings/ide-gsettings-file-settings.c \
gsettings/ide-gsettings-file-settings.h \
gsettings/ide-language-defaults.c \
@@ -226,8 +224,6 @@ libide_1_0_la_SOURCES = \
modelines/ide-modelines-file-settings.h \
modelines/modeline-parser.c \
modelines/modeline-parser.h \
- pygobject/ide-pygobject-script.c \
- pygobject/ide-pygobject-script.h \
theatrics/ide-box-theatric.c \
theatrics/ide-box-theatric.h \
util/ide-cairo.c \
@@ -255,11 +251,9 @@ libide_1_0_la_includes = \
-I$(srcdir)/doap \
-I$(srcdir)/editorconfig \
-I$(srcdir)/git \
- -I$(srcdir)/gjs \
-I$(srcdir)/gsettings \
-I$(srcdir)/local \
-I$(srcdir)/modelines \
- -I$(srcdir)/pygobject \
-I$(srcdir)/resources \
-I$(srcdir)/theatrics \
-I$(srcdir)/util \
@@ -307,6 +301,28 @@ libide_1_0_la_built_sources = \
resources/ide-resources.h \
$(NULL)
+if ENABLE_GJS_SCRIPTING
+libide_1_0_la_includes += -I$(srcdir)/gjs
+libide_1_0_la_SOURCES += \
+ gjs/ide-gjs-script.cpp \
+ gjs/ide-gjs-script.h
+libide_1_0_la_CFLAGS += \
+ $(GJS_CFLAGS) \
+ -DENABLE_GJS_SCRIPTING
+libide_1_0_la_LIBADD += $(GJS_LIBS)
+endif
+
+if ENABLE_PYTHON_SCRIPTING
+libide_1_0_la_includes += -I$(srcdir)/pygobject
+libide_1_0_la_SOURCES += \
+ pygobject/ide-pygobject-script.c \
+ pygobject/ide-pygobject-script.h
+libide_1_0_la_CFLAGS += \
+ $(PYGOBJECT_CFLAGS) \
+ -DENABLE_PYTHON_SCRIPTING
+libide_1_0_la_LIBADD += $(PYGOBJECT_LIBS)
+endif
+
glib_enum_h = ide-enums.h
glib_enum_c = ide-enums.c
diff --git a/libide/ide.c b/libide/ide.c
index 70d5441..54c6775 100644
--- a/libide/ide.c
+++ b/libide/ide.c
@@ -28,14 +28,20 @@
#include "ide-editorconfig-file-settings.h"
#include "ide-file-settings.h"
#include "ide-git-vcs.h"
-#include "ide-gjs-script.h"
#include "ide-gsettings-file-settings.h"
#include "ide-modelines-file-settings.h"
#include "ide-internal.h"
#include "ide-project-miner.h"
-#include "ide-pygobject-script.h"
#include "ide-search-provider.h"
+#ifdef ENABLE_GJS_SCRIPTING
+# include "ide-gjs-script.h"
+#endif
+
+#ifdef ENABLE_PYTHON_SCRIPTING
+# include "ide-pygobject-script.h"
+#endif
+
#include "modeline-parser.h"
static gboolean gProgramNameRead;
@@ -96,15 +102,19 @@ ide_init_ctor (void)
IDE_FILE_SETTINGS_EXTENSION_POINT".gsettings",
-300);
+#ifdef ENABLE_GJS_SCRIPTING
g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT,
IDE_TYPE_GJS_SCRIPT,
IDE_SCRIPT_EXTENSION_POINT".gjs",
-100);
+#endif
+#ifdef ENABLE_PYTHON_SCRIPTING
g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT,
IDE_TYPE_PYGOBJECT_SCRIPT,
IDE_SCRIPT_EXTENSION_POINT".py",
-100);
+#endif
g_io_extension_point_implement (IDE_VCS_EXTENSION_POINT,
IDE_TYPE_GIT_VCS,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]