[Spice-devel] [spice-xpi 6/6] Make spice.xpi build optional

Christophe Fergeau cfergeau at redhat.com
Mon Mar 11 02:16:45 PDT 2013


Now that we switched to using the headers from npapi-sdk to build
the spice-xpi plugin, the only reason we are depending on xulrunner
is to build an xpi package for the plugin for easier installation
in firefox. However, this .xpi is not installed by default nor
packaged by distributions, so it's not in wide use.

This commit makes its build optional as this has the side-effect
on making the xulrunner dependency optional as well, which is a
good thing as xulrunner is huge and not necessarily available
on all platforms we'd like to build spice-xpi on.
---
 SpiceXPI/Makefile.am            | 2 ++
 SpiceXPI/src/plugin/Makefile.am | 7 ++++++-
 configure.ac                    | 7 +++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/SpiceXPI/Makefile.am b/SpiceXPI/Makefile.am
index d4bf15a..de058b5 100644
--- a/SpiceXPI/Makefile.am
+++ b/SpiceXPI/Makefile.am
@@ -1,5 +1,6 @@
 SUBDIRS = src
 
+if BUILD_XPI
 spicedatadir = $(datadir)/spice
 
 DISTDIR = dist
@@ -18,3 +19,4 @@ SpiceXPI.xpi: $(srcdir)/src/install.rdf src/plugin/nsISpicec.xpt src/plugin/.lib
 
 distclean-local:
 	rm -rf $(DISTDIR)
+endif
diff --git a/SpiceXPI/src/plugin/Makefile.am b/SpiceXPI/src/plugin/Makefile.am
index 4e114ff..d5434e5 100644
--- a/SpiceXPI/src/plugin/Makefile.am
+++ b/SpiceXPI/src/plugin/Makefile.am
@@ -36,7 +36,6 @@ libnsISpicec_la_SOURCES =			\
 	npn_gate.cpp				\
 	npp_gate.cpp				\
 	npplat.h				\
-	nsISpicec.h				\
 	nsISpicec.idl				\
 	nsScriptablePeer.cpp			\
 	nsScriptablePeer.h			\
@@ -48,6 +47,11 @@ libnsISpicec_la_SOURCES =			\
 	pluginbase.h				\
 	$(NULL)
 
+if BUILD_XPI
+libnsISpicec_la_SOURCES +=			\
+	nsISpicec.h				\
+	$(NULL)
+
 nsISpicec.h: nsISpicec.idl
 	$(AM_V_GEN)$(PYTHON) `pkg-config --variable=sdkdir libxul`/sdk/bin/header.py --cachedir . -I $(SDK_INCLUDE_DIR) $< -o $@
 
@@ -68,3 +72,4 @@ CLEANFILES =					\
 	xpidlyacc.py				\
 	xpidlyacc.pyc				\
 	xpidl_debug
+endif
diff --git a/configure.ac b/configure.ac
index fa7a253..a6daa7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,11 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
+AC_ARG_ENABLE([xpi],
+  [AS_HELP_STRING([--enable-xpi],
+                  [Enable compilation of an xpi package])],
+  [], [enable_xpi=no])
+if test x"$enable_xpi" != xno; then
 PKG_CHECK_MODULES(XUL, libxul-embedding >= 10)
 AC_SUBST(XUL_CFLAGS)
 AC_SUBST(XUL_LIBS)
@@ -36,6 +41,8 @@ XUL_INCLUDEDIR=`pkg-config --variable=includedir libxul`
 XUL_IDLDIR=`pkg-config --variable=idldir libxul`
 AC_SUBST(XUL_INCLUDEDIR)
 AC_SUBST(XUL_IDLDIR)
+fi
+AM_CONDITIONAL([BUILD_XPI], [test x"$enable_xpi" != xno])
 
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
-- 
1.8.1.4



More information about the Spice-devel mailing list