Merge branch 'master' of ssh://69.25.196.28:822/srv/git/moonshot-ui
authorSam Thursfield <samthursfield@codethink.co.uk>
Wed, 6 Jul 2011 15:30:00 +0000 (16:30 +0100)
committerSam Thursfield <samthursfield@codethink.co.uk>
Wed, 6 Jul 2011 15:49:24 +0000 (16:49 +0100)
Makefile.am
README.windows
configure.ac
libmoonshot/libmoonshot-msrpc.c
libmoonshot/libmoonshot.def [new file with mode: 0644]
libmoonshot/libmoonshot.h
tests/basic.c

index e5454a5..99e3392 100644 (file)
@@ -59,6 +59,11 @@ src_moonshot_CFLAGS = -mwindows
 AM_CPPFLAGS += -DOS_WIN32
 AM_VALAFLAGS += --define=OS_WIN32
 
+noinst_DATA = libmoonshot/libmoonshot.lib
+
+libmoonshot/libmoonshot.lib: libmoonshot/libmoonshot.def
+       "${MSVC_LIB}" -def:$< -out:$@ -machine:x86
+
 endif
 
 
@@ -137,7 +142,7 @@ examples_client_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
 examples_client_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
 
 tests_basic_SOURCES = tests/basic.c
-tests_basic_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
+tests_basic_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
 tests_basic_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la $(moonshot_LIBS)
 
 
index cfd7767..ff5af82 100644 (file)
@@ -43,7 +43,14 @@ extract into c:\tools\mingw:
 (Alternately you can fetch the source for the w32api package from
  www.sourceforge.net/projects/mingw and apply the patch yourself)
 
-You will need to compile and install the msrpc-mingw package.
+You will need to compile and install the msrpc-mingw package, which wraps
+MIDL.EXE and the RPC API to make it usable from gcc.
+
+  git clone git://github.com/ssssam/msrpc-mingw.git
+  cd msrpc-mingw
+  MIDL=/c/Program\ Files/Microsoft SDKs/Windows/v7.0/bin/MIDL.exe ./waf configure --prefix=c:/build
+  ./waf
+  ./waf install
 
 You can then build moonshot from the MSYS shell:
 
index 9afbc11..4300ded 100644 (file)
@@ -24,24 +24,26 @@ AC_CANONICAL_HOST
 case "$host" in
   *-*-mingw*)
     win32=yes
-    IPC_MODULE="msrpc-glib2-1.0"
+    SERVER_IPC_MODULE="msrpc-glib2-1.0"
+    CLIENT_IPC_MODULE="msrpc-mingw-1.0"
     ;;
   *)
     win32=no
-    IPC_MODULE="dbus-glib-1"
+    SERVER_IPC_MODULE="dbus-glib-1"
+    CLIENT_IPC_MODULE="dbus-glib-1"
     ;;
 esac
 
 AM_CONDITIONAL([OS_WIN32], [test "$win32" = "yes"])
-AM_CONDITIONAL([IPC_MSRPC], [test "$IPC_MODULE" = "msrpc-glib2-1.0"])
-AM_CONDITIONAL([IPC_DBUS], [test "$IPC_MODULE" = "dbus-glib-1"])
+AM_CONDITIONAL([IPC_MSRPC], [test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"])
+AM_CONDITIONAL([IPC_DBUS], [test "$SERVER_IPC_MODULE" = "dbus-glib-1"])
 
 # Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
 AM_PROG_VALAC([0.9])
 
-if test "$IPC_MODULE" = "msrpc-glib2-1.0"; then
+if test "$SERVER_IPC_MODULE" = "msrpc-glib2-1.0"; then
   # MS RPC utilities
   AC_PATH_MSRPC_MINGW([0.1.0], :,
     AC_MSG_ERROR([
@@ -62,19 +64,48 @@ fi
 if test "$win32" = "yes"; then
   # Other Windows-specific tools
 
+  # LIB.EXE from MSVC to build an MSVC-compatible import library.
+  AC_PATH_PROG([MSVC_LIB], [lib], no)
+
+  if test "$MSVC_LIB" = "no"; then
+     AC_MSG_WARN([
+*** Could not find the Microsoft 'LIB.EXE' program. This is required
+*** to build the Visual C import library for libmoonshot. Use the
+*** MSVC_LIB environment variable to pass its location if this is
+*** outside the PATH.])
+  fi
+
+
   # ImageMagick for the 'make icons' target. Watch that it doesn't pick up
   # c:/windows/system32/convert.exe, which is nothing to do with ImageMagick
-  AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], ,
+  AC_PATH_PROG([IMAGEMAGICK_CONVERT], [convert], no,
                [/c/Program\ Files/ImageMagick$PATH_SEPARATOR$PATH])
 
+  if test "$IMAGEMAGICK_CONVERT" = "no"; then
+     AC_MSG_WARN([
+*** Could not find ImageMagick convert.exe. This is required for the
+*** 'make icons' target. Use the IMAGEMAGICK_CONVERT environment
+*** variable to pass its location if this is outside the PATH.])
+  fi
+
+
   # Windows Installer XML tools
-  AC_PATH_PROG([WIX_CANDLE], [candle], ,
+  AC_PATH_PROG([WIX_CANDLE], [candle], no,
                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
-  AC_PATH_PROG([WIX_LIGHT], [light], ,
+  AC_PATH_PROG([WIX_LIGHT], [light], no,
                [/c/Program\ Files/Windows\ Installer\ XML\ v3.5/bin$PATH_SEPARATOR$PATH])
+
+  if test "$WIX_CANDLE" = "no" || test "$WIX_LIGHT" = "no"; then
+     AC_MSG_WARN([
+*** Could not find the Windows Installer XML tools. These are required
+*** for the 'make installer' target. Use the WIX_CANDLE and WIX_LIGHT
+*** environment variables to pass their locations if they are outside
+*** the PATH.])
+  fi
 fi
 
 AC_SUBST(MIDL)
+AC_SUBST(MSVC_LIB)
 AC_SUBST(IMAGEMAGICK_CONVERT)
 AC_SUBST(WIX_CANDLE)
 AC_SUBST(WIX_LIGHT)
@@ -85,11 +116,11 @@ PKG_CHECK_MODULES(moonshot,[
         glib-2.0 >= 2.24
         gobject-2.0 >= 2.24
         gtk+-2.0 >= 2.20
-        $IPC_MODULE
+        $SERVER_IPC_MODULE
 ])
 
 PKG_CHECK_MODULES(libmoonshot,[
-        $IPC_MODULE
+        $CLIENT_IPC_MODULE
 ])
 
 # i18n stuff
index 44d1ef5..bfea62d 100644 (file)
 #define MOONSHOT_ENDPOINT_NAME "/org/janet/Moonshot"
 #define MOONSHOT_INSTALL_PATH_KEY "Software\\Moonshot"
 
+void *__RPC_USER MIDL_user_allocate (size_t size) {
+       return malloc (size);
+}
+
+void __RPC_USER MIDL_user_free (void *data) {
+       free (data);
+}
 
 static MoonshotError *moonshot_error_new_from_status (MoonshotErrorCode code,
                                                       DWORD             status)
diff --git a/libmoonshot/libmoonshot.def b/libmoonshot/libmoonshot.def
new file mode 100644 (file)
index 0000000..0819d1b
--- /dev/null
@@ -0,0 +1,6 @@
+LIBRARY libmoonshot-0.dll
+EXPORTS
+    moonshot_error_free
+    moonshot_error_new
+    moonshot_get_default_identity
+    moonshot_get_identity
index 381b944..d4af826 100644 (file)
@@ -65,7 +65,7 @@ void moonshot_error_free (MoonshotError *error);
  * @subject_name_constraint_out: Set if @ca_certificate is set, otherwise %NULL.
  * @subject_alt_name_constraint_out: Set if @ca_certificate is set, otherwise
  *                                   %NULL.
- * @error: Return location for a #MoonshotError, or %NULL.
+ * @error: Return location for a #MoonshotError.
  *
  * This function calls the Moonshot server to request an ID card. The server
  * will be activated if it is not already running. The user interface will be
@@ -78,8 +78,9 @@ void moonshot_error_free (MoonshotError *error);
  * constraints will be returned.
  *
  * Error reporting is handled by a simple mechanism similar to #GError. If
- * an error occurs, a #MoonshotError object will be stored at *@error, with
- * a code and message string. This must be freed using moonshot_error_free().
+ * an error occurs, as well as returning %FALSE a #MoonshotError object will
+ * be stored at *@error, with a code and message string. This must be freed
+ * using moonshot_error_free().
  *
  * Return value: %TRUE if an identity was successfully selected, %FALSE on
  *               failure.
@@ -107,7 +108,7 @@ int moonshot_get_identity (const char     *nai,
  * @subject_name_constraint_out: Set if @ca_certificate is set, otherwise %NULL.
  * @subject_alt_name_constraint_out: Set if @ca_certificate is set, otherwise
  *                                   %NULL.
- * @error: Return location for a #MoonshotError, or %NULL.
+ * @error: Return location for a #MoonshotError.
  *
  * This function calls the Moonshot server to request the default identity
  * (the one most recently used). Its semantics are otherwise the same as
index 25a4945..76a3174 100644 (file)
@@ -27,8 +27,8 @@ gpointer test_func (gpointer data)
                                              &subject_alt_name_constraint,
                                              error);
 
-    if (success)
-        g_print ("Got id: %s %s\n", nai, password);
+    /*if (success)
+        g_print ("Got id: %s %s\n", nai, password);*/
 
     return GINT_TO_POINTER (success);
 }
@@ -92,7 +92,7 @@ int main (int argc, char *argv[])
     g_test_init (&argc, &argv, NULL);
 
     g_test_add_func ("/basic/connect", test_connect);
-    //g_test_add_func ("/basic/multithread", test_multithread);
+    g_test_add_func ("/basic/multithread", test_multithread);
 
     g_test_run ();
 }