wlt: link font library statically
authorDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 24 Jan 2013 19:32:40 +0000 (20:32 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 24 Jan 2013 19:32:40 +0000 (20:32 +0100)
We need the font layer to build wlterm. However, the font layer depends on
kmscon internal module handling so we cannot do this. To avoid this, we
simply provide dummy handlers for the kmscon_module_* layer and link it
anyway. This is kind of ugly but works, yey!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Makefile.am
configure.ac
src/wlt_main.c

index b861521..2e464a5 100644 (file)
@@ -583,6 +583,8 @@ wlterm_SOURCES = \
        $(SHL_ARRAY) \
        $(SHL_DLIST) \
        $(SHL_HOOK) \
+       $(SHL_REGISTER) \
+       $(SHL_HASHTABLE) \
        src/wlt_main.h \
        src/wlt_main.c \
        src/wlt_toolkit.h \
@@ -596,13 +598,19 @@ wlterm_SOURCES = \
        src/conf.h \
        src/conf.c \
        src/pty.h \
-       src/pty.c
+       src/pty.c \
+       src/font.h \
+       src/font.c \
+       src/font_8x16.c \
+       src/font_pango.c
 wlterm_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        $(WAYLAND_CFLAGS) \
+       $(PANGO_CFLAGS) \
        $(XKBCOMMON_CFLAGS)
 wlterm_LDADD = \
        $(WAYLAND_LIBS) \
+       $(PANGO_LIBS) \
        $(XKBCOMMON_LIBS) \
        libeloop.la \
        libtsm.la \
index 020fac8..eaa3db4 100644 (file)
@@ -740,6 +740,11 @@ if test ! "x$enable_wlterm" = "xno" ; then
                 wlterm_missing="$eloop_missing,$wlterm_missing"
         fi
 
+        if test "x$font_pango_avail" = "xno" ; then
+                wlterm_avail=no
+                wlterm_missing="$font_pango_missing,$wlterm_missing"
+        fi
+
         if test "x$have_wayland" = "xno" ; then
                 wlterm_avail=no
                 wlterm_missing="libwayland,$wlterm_missing"
@@ -769,6 +774,7 @@ if test "x$wlterm_avail" = "xyes" ; then
                 wlterm_enabled=yes
                 enable_eloop=yes
                 enable_tsm=yes
+                enable_font_pango=yes
         fi
 fi
 
index 6863e7a..061544c 100644 (file)
 #include <wayland-client.h>
 #include "conf.h"
 #include "eloop.h"
+#include "font.h"
 #include "log.h"
 #include "shl_dlist.h"
 #include "shl_misc.h"
-#include "text.h"
 #include "wlt_main.h"
 #include "wlt_terminal.h"
 #include "wlt_theme.h"
@@ -54,6 +54,18 @@ struct wlt_app {
        struct wlt_window *wnd;
 };
 
+/* TODO: The font layer depends on kmscon modules. However, the WLT applications
+ * doesn't use them. Therefore, we provide dummy kmscon_module_* helpers here
+ * which satisfy the dependencies and allow us to link to font.so. */
+
+void kmscon_module_ref(struct kmscon_module *m)
+{
+}
+
+void kmscon_module_unref(struct kmscon_module *m)
+{
+}
+
 static void sig_generic(struct ev_eloop *eloop, struct signalfd_siginfo *info,
                        void *data)
 {
@@ -434,6 +446,7 @@ int main(int argc, char **argv)
        log_print_init("wlterm");
 
        kmscon_font_register(&kmscon_font_8x16_ops);
+       kmscon_font_register(&kmscon_font_pango_ops);
 
        memset(&app, 0, sizeof(app));
        ret = setup_app(&app);
@@ -443,6 +456,7 @@ int main(int argc, char **argv)
        ev_eloop_run(app.eloop, -1);
 
        destroy_app(&app);
+       kmscon_font_unregister(kmscon_font_pango_ops.name);
        kmscon_font_unregister(kmscon_font_8x16_ops.name);
        conf_ctx_free(conf);
        log_info("exiting");
@@ -450,6 +464,7 @@ int main(int argc, char **argv)
        return EXIT_SUCCESS;
 
 err_unload:
+       kmscon_font_unregister(kmscon_font_pango_ops.name);
        kmscon_font_unregister(kmscon_font_8x16_ops.name);
 err_conf:
        conf_ctx_free(conf);