[devhelp/wip/devhelp-next] Better #includes in public lib headers



commit 8fde04f333186c2a44636796a4f081b88337d5e2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Feb 22 16:00:34 2018 +0100

    Better #includes in public lib headers
    
    Now that the lib is in devhelp/ (and not src/), it's possible to have
    better #includes.
    
    The build failed for GObject Introspection support, so copy how it is
    done in gspell.

 devhelp/Makefile.am              |   50 +++++++++++++++++++------------------
 devhelp/devhelp.h                |   18 +++++++-------
 devhelp/dh-assistant-view.h      |    4 +-
 devhelp/dh-book-tree.h           |    2 +-
 devhelp/dh-book.h                |    2 +-
 devhelp/dh-keyword-model.h       |    2 +-
 devhelp/dh-sidebar.h             |    4 +-
 unit-tests/Makefile.am           |    8 +++---
 unit-tests/test-completion.c     |    2 +-
 unit-tests/test-link.c           |    2 +-
 unit-tests/test-search-context.c |    2 +-
 unit-tests/test-util.c           |    2 +-
 12 files changed, 50 insertions(+), 48 deletions(-)
---
diff --git a/devhelp/Makefile.am b/devhelp/Makefile.am
index 8687bf4..e69b344 100644
--- a/devhelp/Makefile.am
+++ b/devhelp/Makefile.am
@@ -122,41 +122,43 @@ EXTRA_DIST =                              \
 
 CLEANFILES = $(BUILT_SOURCES)
 
-# GObject Introspection
+if HAVE_INTROSPECTION
 -include $(INTROSPECTION_MAKEFILE)
-INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS =                   \
-       --add-include-path=$(srcdir)            \
-       --warn-all                              \
-       --identifier-prefix Dh                  \
-       --identifier-prefix dh                  \
-       --pkg-export libdevhelp-3.0             \
-       --c-include="devhelp/devhelp.h"
+INTROSPECTION_GIRS = Devhelp-3.0.gir
 
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+INTROSPECTION_SCANNER_ENV = CC="$(CC)"
 
-if HAVE_INTROSPECTION
-introspection_sources =                        \
-       $(libdevhelp_public_c_files)            \
+Devhelp-3.0.gir: libdevhelp-3.la $(BUILT_SOURCES)
+INTROSPECTION_SCANNER_ARGS =           \
+       -I$(top_srcdir)                 \
+       -I$(top_builddir)               \
+       --identifier-prefix Dh          \
+       --identifier-prefix dh          \
+       --c-include=devhelp/devhelp.h   \
+       --warn-all
+Devhelp_3_0_gir_CFLAGS = $(DEVHELP_CFLAGS)
+Devhelp_3_0_gir_SCANNERFLAGS = $(WARN_SCANNERFLAGS)
+Devhelp_3_0_gir_LIBS = libdevhelp-3.la
+Devhelp_3_0_gir_FILES =                                \
        $(libdevhelp_public_headers)            \
-       $(libdevhelp_built_public_c_files)      \
-       $(libdevhelp_built_public_headers)
+       $(libdevhelp_public_c_files)            \
+       $(libdevhelp_built_public_headers)      \
+       $(libdevhelp_built_public_c_files)
 
-Devhelp-3.0.gir: libdevhelp-3.la
 Devhelp_3_0_gir_INCLUDES = Gtk-3.0 WebKit2-4.0
-Devhelp_3_0_gir_CFLAGS = $(INCLUDES)
-Devhelp_3_0_gir_LIBS = libdevhelp-3.la
-Devhelp_3_0_gir_FILES = $(introspection_sources)
-Devhelp_3_0_gir_SCANNERFLAGS = $(WARN_SCANNERFLAGS)
-INTROSPECTION_GIRS += Devhelp-3.0.gir
+Devhelp_3_0_gir_PACKAGES = gtk+-3.0 webkit2gtk-4.0
+Devhelp_3_0_gir_EXPORT_PACKAGES = libdevhelp-3.0
 
 girdir = $(datadir)/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
+gir_DATA = Devhelp-3.0.gir
 
 typelibdir = $(libdir)/girepository-1.0
-typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+typelib_DATA = Devhelp-3.0.typelib
+
+CLEANFILES +=          \
+       $(gir_DATA)     \
+       $(typelib_DATA)
 
-CLEANFILES += $(gir_DATA) $(typelib_DATA)
 endif # HAVE_INTROSPECTION
 
 -include $(top_srcdir)/git.mk
diff --git a/devhelp/devhelp.h b/devhelp/devhelp.h
index c693914..2acb516 100644
--- a/devhelp/devhelp.h
+++ b/devhelp/devhelp.h
@@ -21,14 +21,14 @@
 
 /* Include all the public headers. */
 
-#include "dh-assistant-view.h"
-#include "dh-book.h"
-#include "dh-book-manager.h"
-#include "dh-book-tree.h"
-#include "dh-completion.h"
-#include "dh-init.h"
-#include "dh-keyword-model.h"
-#include "dh-link.h"
-#include "dh-sidebar.h"
+#include <devhelp/dh-assistant-view.h>
+#include <devhelp/dh-book.h>
+#include <devhelp/dh-book-manager.h>
+#include <devhelp/dh-book-tree.h>
+#include <devhelp/dh-completion.h>
+#include <devhelp/dh-init.h>
+#include <devhelp/dh-keyword-model.h>
+#include <devhelp/dh-link.h>
+#include <devhelp/dh-sidebar.h>
 
 #endif /* DEVHELP_H */
diff --git a/devhelp/dh-assistant-view.h b/devhelp/dh-assistant-view.h
index 8404b34..a30bc0b 100644
--- a/devhelp/dh-assistant-view.h
+++ b/devhelp/dh-assistant-view.h
@@ -22,8 +22,8 @@
 #define DH_ASSISTANT_VIEW_H
 
 #include <webkit2/webkit2.h>
-#include "dh-book-manager.h"
-#include "dh-link.h"
+#include <devhelp/dh-book-manager.h>
+#include <devhelp/dh-link.h>
 
 G_BEGIN_DECLS
 
diff --git a/devhelp/dh-book-tree.h b/devhelp/dh-book-tree.h
index 2399547..62b1202 100644
--- a/devhelp/dh-book-tree.h
+++ b/devhelp/dh-book-tree.h
@@ -20,7 +20,7 @@
 #define DH_BOOK_TREE_H
 
 #include <gtk/gtk.h>
-#include "dh-link.h"
+#include <devhelp/dh-link.h>
 
 G_BEGIN_DECLS
 
diff --git a/devhelp/dh-book.h b/devhelp/dh-book.h
index 4149f88..030511e 100644
--- a/devhelp/dh-book.h
+++ b/devhelp/dh-book.h
@@ -24,7 +24,7 @@
 #define DH_BOOK_H
 
 #include <gio/gio.h>
-#include "dh-completion.h"
+#include <devhelp/dh-completion.h>
 
 G_BEGIN_DECLS
 
diff --git a/devhelp/dh-keyword-model.h b/devhelp/dh-keyword-model.h
index 8c324a8..adbc8b0 100644
--- a/devhelp/dh-keyword-model.h
+++ b/devhelp/dh-keyword-model.h
@@ -21,7 +21,7 @@
 #define DH_KEYWORD_MODEL_H
 
 #include <glib-object.h>
-#include "dh-link.h"
+#include <devhelp/dh-link.h>
 
 G_BEGIN_DECLS
 
diff --git a/devhelp/dh-sidebar.h b/devhelp/dh-sidebar.h
index 07282d4..cf7a9ca 100644
--- a/devhelp/dh-sidebar.h
+++ b/devhelp/dh-sidebar.h
@@ -23,8 +23,8 @@
 #define DH_SIDEBAR_H
 
 #include <gtk/gtk.h>
-#include "dh-book-manager.h"
-#include "dh-link.h"
+#include <devhelp/dh-book-manager.h>
+#include <devhelp/dh-link.h>
 
 G_BEGIN_DECLS
 
diff --git a/unit-tests/Makefile.am b/unit-tests/Makefile.am
index cadb8a5..35d80b4 100644
--- a/unit-tests/Makefile.am
+++ b/unit-tests/Makefile.am
@@ -1,7 +1,7 @@
-AM_CPPFLAGS =                          \
-       -I$(top_srcdir)/devhelp         \
-       -I$(top_builddir)/devhelp       \
-       $(WARN_CFLAGS)                  \
+AM_CPPFLAGS =                  \
+       -I$(top_srcdir)         \
+       -I$(top_builddir)       \
+       $(WARN_CFLAGS)          \
        $(DEVHELP_CFLAGS)
 
 AM_LDFLAGS = $(WARN_LDFLAGS)
diff --git a/unit-tests/test-completion.c b/unit-tests/test-completion.c
index 90d1436..8a3d9ee 100644
--- a/unit-tests/test-completion.c
+++ b/unit-tests/test-completion.c
@@ -16,7 +16,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "devhelp.h"
+#include <devhelp/devhelp.h>
 
 static void
 test_empty (void)
diff --git a/unit-tests/test-link.c b/unit-tests/test-link.c
index 71d0d61..ca7bca5 100644
--- a/unit-tests/test-link.c
+++ b/unit-tests/test-link.c
@@ -15,7 +15,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "devhelp.h"
+#include <devhelp/devhelp.h>
 
 #define DEVHELP_BOOK_BASE_PATH "/usr/share/gtk-doc/html/devhelp-3"
 
diff --git a/unit-tests/test-search-context.c b/unit-tests/test-search-context.c
index 69a15f3..33ebb79 100644
--- a/unit-tests/test-search-context.c
+++ b/unit-tests/test-search-context.c
@@ -16,7 +16,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "dh-search-context.h"
+#include "devhelp/dh-search-context.h"
 
 static gboolean
 strv_equal (GStrv strv1,
diff --git a/unit-tests/test-util.c b/unit-tests/test-util.c
index 6060e58..6f6fe8f 100644
--- a/unit-tests/test-util.c
+++ b/unit-tests/test-util.c
@@ -15,7 +15,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "dh-util.h"
+#include "devhelp/dh-util.h"
 
 static void
 check_get_possible_index_files (const gchar *book_directory_path,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]