diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/plugin.cpp | 33 | ||||
-rw-r--r-- | configure.ac | 201 | ||||
-rw-r--r-- | data/Makefile.am | 3 | ||||
-rw-r--r-- | data/test.html | 84 |
5 files changed, 107 insertions, 218 deletions
diff --git a/Makefile.am b/Makefile.am index 2571f43..b811df8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ -SUBDIRS = SpiceXPI +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = SpiceXPI data EXTRA_DIST = \ m4 diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp index 82e81c2..e7ea27a 100644 --- a/SpiceXPI/src/plugin/plugin.cpp +++ b/SpiceXPI/src/plugin/plugin.cpp @@ -104,23 +104,6 @@ namespace { return dest; } - - std::string getSpicecPath() - { - std::set<std::string> names; - names.insert("/usr/libexec/spicec"); - names.insert("/usr/bin/spicec"); - - struct stat file; - std::set<std::string>::iterator it; - for (it = names.begin(); it != names.end(); ++it) - { - if (stat(it->c_str(), &file) == 0) - return *it; - } - - return std::string(); - } } char *NPP_GetMIMEDescription(void) @@ -571,18 +554,14 @@ void nsPluginInstance::Connect() LOG_DEBUG("child pid: " << child); if (child == 0) { - std::string spicec_path = getSpicecPath(); - if (spicec_path.empty()) - { - LOG_ERROR("ERROR failed to find spicec to run"); - exit(1); - } + execl("/usr/libexec/spice-xpi-client", "/usr/libexec/spice-xpi-client", NULL); + LOG_ERROR("ERROR failed to run spice-xpi-client"); - // run the controller - execl(spicec_path.c_str(), spicec_path.c_str(), "--controller", NULL); + // TODO: temporary fallback for backward compatibility + execl("/usr/bin/spicec", "/usr/bin/spicec", "--controller", NULL); + LOG_ERROR("ERROR failed to run spicec fallback"); - // failed to connect? - exit(0); + exit(1); } else { diff --git a/configure.ac b/configure.ac index f09c68d..46dc6c2 100644 --- a/configure.ac +++ b/configure.ac @@ -15,109 +15,36 @@ AC_CANONICAL_HOST AC_PROG_LIBTOOL AM_PROG_CC_C_O -# Before making a release, the SPICE_LT_VERSION string should be modified. -# The string is of the form C:R:A. -# - If interfaces have been changed or added, but binary compatibility has -# been preserved, change to C+1:0:A+1 -# - If binary compatibility has been broken (eg removed or changed interfaces) -# change to C+1:0:0 -# - If the interface is the same as the previous version, change to C:R+1:A -SPICE_LT_VERSION=0:0:0 -AC_SUBST(SPICE_LT_VERSION) - # Check for the CPU we are using # AC_MSG_CHECKING(for x86 or x86-64 platform) case $host_cpu in i386|i486|i586|i686|i786|k6|k7) - variant=32 + variant=32 ;; x86_64) - variant=64 - ;; + variant=64 + ;; *) - AC_MSG_RESULT(no) - echo Only x86 and x86-64 are supported - exit 1 + AC_MSG_RESULT(no) + echo Only x86 and x86-64 are supported + exit 1 esac AC_MSG_RESULT($variant bit) AM_CONDITIONAL([X86_64], [test "$variant" = 64]) -AC_MSG_CHECKING([for native Win32]) -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -AC_MSG_RESULT([$os_win32]) - -case $host in - *-*-linux*) - os_linux=yes - ;; -esac - -dnl ========================================================================= -dnl Check OS target - -AC_MSG_CHECKING([for some Win32 platform]) -case "$host" in - *-*-mingw*|*-*-cygwin*) - platform_win32=yes - ;; - *) - platform_win32=no - ;; -esac -AC_MSG_RESULT([$platform_win32]) -if test "$platform_win32" = yes; then - red_target=windows -else - red_target=x11 -fi -AC_SUBST(red_target) - -AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") -AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes") -AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes") - dnl ========================================================================= dnl Check deps -AC_CHECK_LIBM -AC_SUBST(LIBM) - -AC_CHECK_LIB(rt, clock_gettime, - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()]) - LIBRT=-lrt - ) -AC_SUBST(LIBRT) - -SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT" - -SPICE_REQUIRES="" - PKG_CHECK_MODULES(LOG4CPP, log4cpp) AC_SUBST(LOG4CPP_CFLAGS) AC_SUBST(LOG4CPP_LIBS) -SPICE_REQUIRES+=" log4cpp" - -# Add parameter for (partial) static linkage of spice client. -# this is used to achive single binary package for all (?) distros. -AC_ARG_ENABLE(static-linkage, - [ --enable-static-linkage will generate spice client binary with static linkage to external libraries ], - [SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"]; - SPICEC_STATIC_LINKAGE_BDYNAMIC=["-Wl,-Bdynamic"]]) # The explicit nspr dep is needed because libxul-embedding # in RHEL5 is missing the Requires PKG_CHECK_MODULES(XUL, libxul-embedding >= 1.9 nspr >= 4.7.1) AC_SUBST(XUL_CFLAGS) AC_SUBST(XUL_LIBS) -SPICE_REQUIRES+=" libxul-embedding >= 1.9 nspr >= 4.7.1" # Find xpidl for i in `pkg-config --variable=libdir libxul`/xpidl ; do @@ -146,124 +73,20 @@ if test "x$have_xul191" = "xyes" ; then AC_DEFINE([HAVE_XUL191], [], [Define if we have libxul >= 1.9.1]) fi -dnl =========================================================================== -dnl check compiler flags - -AC_DEFUN([SPICE_CC_TRY_FLAG], [ - AC_MSG_CHECKING([whether $CC supports $1]) - - spice_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - - AC_COMPILE_IFELSE([ ], [spice_cc_flag=yes], [spice_cc_flag=no]) - CFLAGS="$spice_save_CFLAGS" - - if test "x$spice_cc_flag" = "xyes"; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi - AC_MSG_RESULT([$spice_cc_flag]) -]) - - -dnl Use lots of warning flags with with gcc and compatible compilers - -dnl Note: if you change the following variable, the cache is automatically -dnl skipped and all flags rechecked. So there's no need to do anything -dnl else. If for any reason you need to force a recheck, just change -dnl MAYBE_WARN in an ignorable way (like adding whitespace) - -dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" - -MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" - - -# invalidate cached value if MAYBE_WARN has changed -if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then - unset spice_cv_warn_cflags -fi -AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [ - echo - WARN_CFLAGS="" - - # Some warning options are not supported by all versions of - # gcc, so test all desired options against the current - # compiler. - # - # Note that there are some order dependencies - # here. Specifically, an option that disables a warning will - # have no net effect if a later option then enables that - # warnings, (perhaps implicitly). So we put some grouped - # options (-Wall and -Wextra) up front and the -Wno options - # last. - - for W in $MAYBE_WARN; do - SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) - done - - spice_cv_warn_cflags=$WARN_CFLAGS - spice_cv_warn_maybe=$MAYBE_WARN - - AC_MSG_CHECKING([which warning flags were supported])]) -WARN_CFLAGS="$spice_cv_warn_cflags" -SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" - -# We only wish to enable attribute(warn_unused_result) if we can prevent -# gcc from generating thousands of warnings about the misapplication of the -# attribute to void functions and variables. -AC_MSG_CHECKING([how to enable unused result warnings]) -warn_unused_result="" -if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then - AC_TRY_COMPILE([__attribute__((__warn_unused_result__)) - int f (int i) { return i; }], [], - [warn_unused_result="__attribute__((__warn_unused_result__))"]) -fi -AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$warn_unused_result], - [Define to the value your compiler uses to support the warn-unused-result attribute]) -AC_MSG_RESULT([$warn_unused_result]) - -AC_SUBST(WARN_CFLAGS) -AC_SUBST(CFLAGS_CFLAGS) - -dnl ========================================================================= -dnl -fvisibility stuff - -have_gcc4=no -AC_MSG_CHECKING(for -fvisibility) -AC_COMPILE_IFELSE([ -#if defined(__GNUC__) && (__GNUC__ >= 4) -#else -error Need GCC 4.0 for visibility -#endif -int main () { return 0; } -], have_gcc4=yes) - -if test "x$have_gcc4" = "xyes"; then - VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden" -fi -AC_MSG_RESULT($have_gcc4) -AC_SUBST(VISIBILITY_HIDDEN_CFLAGS) - - -AC_SUBST(SPICE_REQUIRES) -AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) -AC_SUBST(SPICE_NONPKGCONFIG_LIBS) - -AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC]) -AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC]) +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_OUTPUT([ Makefile +data/Makefile SpiceXPI/Makefile SpiceXPI/src/Makefile SpiceXPI/src/plugin/Makefile ]) dnl ========================================================================== -echo " +AC_MSG_NOTICE([ - Spice $VERSION + Spice-XPI $VERSION ============== prefix: ${prefix} @@ -272,9 +95,7 @@ echo " XUL includes: ${XUL_INCLUDEDIR} XUL IDL files: ${XUL_IDLDIR} - Have XRANDR 1.2: ${have_xrandr12} - Red target: ${red_target} Now type 'make' to build $PACKAGE -" +]) diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..b47e0c0 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,3 @@ +NULL = + +EXTRA_DIST = test.html diff --git a/data/test.html b/data/test.html new file mode 100644 index 0000000..ce94acd --- /dev/null +++ b/data/test.html @@ -0,0 +1,84 @@ +<HTML> +<HEAD> +<TITLE>SPICE xpi test page</TITLE> +</HEAD> +<BODY onload='BodyLoad()' onunload='BodyUnload()'> + +<center> +<h1>SPICE xpi test page</h1> +</center> + +SPICE xpi test page. +<br><br> + +<center> + +<embed type="application/x-spice" width=0 height=0><br> + +<script> + +var embed = document.embeds[0]; + +function BodyLoad() { + document.getElementById("log").innerHTML += "BodyLoad<br>"; +} + +function BodyUnload() { + document.getElementById("log").innerHTML += "BodyUnload<br>"; +} + +function Execute() +{ + document.getElementById("log").innerHTML += "Execute<br>"; + embed.hostIP = document.all["Host"].value; + embed.port = document.all["Port"].value; + embed.SecurePort = document.all["SecurePort"].value; + embed.Password = document.all["Password"].value; + embed.HostSubject = document.all["HostSubject"].value; + embed.TrustStore = document.all["TrustStore"].value; + embed.fullScreen = false; + embed.AdminConsole = (document.all["AdminConsole"].value == "1"); + embed.HotKeys = document.all["HotKeys"].value; + embed.fAudio = true; + embed.connect(); +} + +function Status() +{ + var status = embed.ConnectedStatus(); + document.getElementById("log").innerHTML += "ConnectedStatus = " + status + "<br>"; +} + +function Show() +{ + embed.show(); + document.getElementById("log").innerHTML += "Show was called<br>"; +} + +</script> + + +<br> +Host: <input id="Host" type="text" size="13"> </input> +Port: <input id="Port" type="text" size="13"> </input> <BR> +SecurePort: <input id="SecurePort" type="text" size="13"> </input> <BR> +Password: <input id="Password" type="text" size="13"> </input> +HotKeys: <input id="HotKeys" type="text" size="13" value="release-cursor=ctrl+alt"> </input> +AdminConsole: <input id="AdminConsole" type="text" size="5" value="1"> </input> +<BR> +HostSubject: <input id="HostSubject" type="text" size="60"> </input></br> +TrustStore: <textarea id="TrustStore" type="text" cols="65" rows="15"> </textarea> <BR> + +<input type=button value="Exec" onclick='Execute()'/> +<input type=button value="Check Status" onclick='Status()'> </input> +<input type=button value="Show" onclick='Show()'> </input> + +</center> + + +---<br> +<div id="log"> +</div> +---<br> +</BODY> +</HTML> |