Fix 'make dist'
authorSam Thursfield <samthursfield@codethink.co.uk>
Wed, 29 Jun 2011 16:41:36 +0000 (17:41 +0100)
committerSam Thursfield <samthursfield@codethink.co.uk>
Wed, 29 Jun 2011 16:41:36 +0000 (17:41 +0100)
This is hairy; conditionally compiling .vala files breaks 'make dist'
because every possible generated .c file is required. I've worked
around the problem by putting all the RPC server code into one file
with a big #if, so that all of the .vala files are always compiled.
It's a bit ugly though.

.gitignore
Makefile.am
src/moonshot-server-dbus.vala [deleted file]
src/moonshot-server.vala [moved from src/moonshot-server-msrpc.vala with 60% similarity]

index 389d80f..f15371c 100755 (executable)
@@ -29,12 +29,11 @@ src/moonshot-id.c
 src/moonshot-idcard-widget.c\r
 src/moonshot-identity-request.c\r
 src/moonshot-identities-manager.c\r
-src/moonshot-msrpc-server.c\r
 src/moonshot-msrpc.h\r
 src/moonshot-msrpc_c.c\r
 src/moonshot-msrpc_s.c\r
 src/moonshot-password-dialog.c\r
-src/moonshot-server-dbus.c\r
+src/moonshot-server.c\r
 src/moonshot-utils.c\r
 src/moonshot-window.c\r
 src/msrpc-client.c\r
@@ -74,4 +73,4 @@ moonshot.msi
 moonshot.wixpdb\r
 po/Makefile.in.in\r
 app.wixobj\r
-org.janet.Moonshot.service
\ No newline at end of file
+org.janet.Moonshot.service\r
index ec0fc4b..eedc248 100644 (file)
@@ -22,6 +22,7 @@ src_moonshot_SOURCES = \
         src/moonshot-custom-vbox.vala \
         src/moonshot-identities-manager.vala \
         src/moonshot-identity-request.vala \
+        src/moonshot-server.vala \
         src/moonshot-window.vala \
         src/moonshot-password-dialog.vala \
         src/moonshot-utils.vala
@@ -42,19 +43,18 @@ AM_VALAFLAGS += \
        --pkg msrpc-1.0 \
        --define=IPC_MSRPC
 
-noinst_HEADERS = src/moonshot-msrpc.h
-
 src_moonshot_SOURCES += \
-        src/moonshot-server-msrpc.vala \
-        src/moonshot-msrpc_s.c \
         src/moonshot-msrpc.vapi
 
+nodist_src_moonshot_SOURCES = \
+        src/moonshot-msrpc_s.c
+
 bin_PROGRAMS += src/msrpc-client
 
-src_msrpc_client_SOURCES = \
+nodist_src_msrpc_client_SOURCES = \
         src/msrpc-client.vala \
-        src/moonshot-msrpc_c.c \
-        src/moonshot-msrpc.vapi
+        src/moonshot-msrpc.vapi \
+        src/moonshot-msrpc_c.c
 
 src_msrpc_client_LDADD = \
         $(moonshot_LIBS)
@@ -85,8 +85,6 @@ AM_VALAFLAGS += \
        --pkg dbus-glib-1 \
        --define=IPC_DBUS
 
-src_moonshot_SOURCES += src/moonshot-server-dbus.vala
-
 bin_PROGRAMS += src/dbus-client
 
 src_dbus_client_SOURCES = \
diff --git a/src/moonshot-server-dbus.vala b/src/moonshot-server-dbus.vala
deleted file mode 100644 (file)
index 3bf447c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-[DBus (name = "org.janet.Moonshot")]
-public class MoonshotServer : Object {
-
-    private MainWindow main_window;
-
-    public MoonshotServer (Gtk.Window window)
-    {
-        this.main_window = (MainWindow) window;
-    }
-
-    /**
-     * This is the function used by the GSS mechanism to get the NAI,
-     * password and certificate of the ID card for the specificated service.
-     *
-     * The function will block until the user choose the ID card.
-     *
-     * @param nai NAI of the ID Card (optional)
-     * @param password Password of the ID Card (optional)
-     * @param service Service application request an ID Card for
-     * @param nai_out NAI stored in the ID Card
-     * @param password_out Password stored in the ID Card
-     * @param certificate Certificate stored in th ID Card
-     *
-     * @return true if the user choose a correct ID card for that service,
-     *         false otherwise.
-     */
-    public async bool get_identity (string nai,
-                                    string password,
-                                    string service,
-                                    out string nai_out,
-                                    out string password_out,
-                                    out string certificate_out)
-    {
-        bool has_service = false;
-
-        var request = new IdentityRequest (main_window,
-                                           nai,
-                                           password,
-                                           service);
-        request.set_callback ((IdentityRequest) => get_identity.callback());
-        request.execute ();
-        yield;
-
-        nai_out = "";
-        password_out = "";
-        certificate_out = "";
-
-        var id_card = request.id_card;
-
-        if (id_card != null) {
-            foreach (string id_card_service in id_card.services)
-            {
-                if (id_card_service == service)
-                    has_service = true;
-            }
-
-            if (has_service)
-            {
-                nai_out = id_card.nai;
-                password_out = id_card.password;
-                certificate_out = "certificate";
-
-                return true;
-            }
-        }
-
-        return false;
-    }
-}
similarity index 60%
rename from src/moonshot-server-msrpc.vala
rename to src/moonshot-server.vala
index 35f3207..05d41d3 100644 (file)
@@ -1,3 +1,77 @@
+#if IPC_DBUS
+
+[DBus (name = "org.janet.Moonshot")]
+public class MoonshotServer : Object {
+
+    private MainWindow main_window;
+
+    public MoonshotServer (Gtk.Window window)
+    {
+        this.main_window = (MainWindow) window;
+    }
+
+    /**
+     * This is the function used by the GSS mechanism to get the NAI,
+     * password and certificate of the ID card for the specificated service.
+     *
+     * The function will block until the user choose the ID card.
+     *
+     * @param nai NAI of the ID Card (optional)
+     * @param password Password of the ID Card (optional)
+     * @param service Service application request an ID Card for
+     * @param nai_out NAI stored in the ID Card
+     * @param password_out Password stored in the ID Card
+     * @param certificate Certificate stored in th ID Card
+     *
+     * @return true if the user choose a correct ID card for that service,
+     *         false otherwise.
+     */
+    public async bool get_identity (string nai,
+                                    string password,
+                                    string service,
+                                    out string nai_out,
+                                    out string password_out,
+                                    out string certificate_out)
+    {
+        bool has_service = false;
+
+        var request = new IdentityRequest (main_window,
+                                           nai,
+                                           password,
+                                           service);
+        request.set_callback ((IdentityRequest) => get_identity.callback());
+        request.execute ();
+        yield;
+
+        nai_out = "";
+        password_out = "";
+        certificate_out = "";
+
+        var id_card = request.id_card;
+
+        if (id_card != null) {
+            foreach (string id_card_service in id_card.services)
+            {
+                if (id_card_service == service)
+                    has_service = true;
+            }
+
+            if (has_service)
+            {
+                nai_out = id_card.nai;
+                password_out = id_card.password;
+                certificate_out = "certificate";
+
+                return true;
+            }
+        }
+
+        return false;
+    }
+}
+
+#elif IPC_MSRPC
+
 using Rpc;
 using MoonshotRpcInterface;
 
@@ -102,3 +176,5 @@ public class MoonshotServer : Object {
         request.mutex.unlock ();
     }
 }
+
+#endif