[gtk/gtk-3-24-meson: 81/95] meson: fix code examples in the gtk docs build



commit 940126c427ac3b7289235ef5909b7f6453d22567
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Mar 31 22:41:46 2019 +0200

    meson: fix code examples in the gtk docs build
    
    getting_started.xml uses relative paths for including code examples
    and for some reason the base path is different with meson than with autotools.
    
    Switch both autotools and meson to generate the file and insert the absolute
    source path instead.
    
    This also cleans up the content file list: the expand content files have to
    be in the content file list as well, so just append them there.

 .gitlab-ci/test-docker-autotools.sh                |  3 +-
 configure.ac                                       |  1 +
 docs/reference/gtk/Makefile.am                     |  6 ++--
 ...{getting_started.xml => getting_started.xml.in} | 42 +++++++++++-----------
 docs/reference/gtk/meson.build                     | 20 +++--------
 docs/reference/meson.build                         |  2 +-
 6 files changed, 32 insertions(+), 42 deletions(-)
---
diff --git a/.gitlab-ci/test-docker-autotools.sh b/.gitlab-ci/test-docker-autotools.sh
index 73d7e8a6f9..32d8cec1e0 100755
--- a/.gitlab-ci/test-docker-autotools.sh
+++ b/.gitlab-ci/test-docker-autotools.sh
@@ -11,5 +11,6 @@ cd _build
 ../autogen.sh \
     --enable-cloudproviders \
     --enable-broadway-backend \
-    --enable-xinerama
+    --enable-xinerama \
+    --enable-gtk-doc
 make -j8
diff --git a/configure.ac b/configure.ac
index f700616649..5615ac7193 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1983,6 +1983,7 @@ docs/reference/gdk/version.xml
 docs/reference/gtk/Makefile
 docs/reference/gtk/gtk3.types
 docs/reference/gtk/version.xml
+docs/reference/gtk/getting_started.xml
 docs/reference/libgail-util/Makefile
 docs/reference/libgail-util/version.xml
 docs/tools/Makefile
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index df9296fcbe..4e20337d7d 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -287,7 +287,7 @@ content_files =                                     \
        css-overview.xml                        \
        css-properties.xml                      \
        drawing-model.xml                       \
-       getting_started.xml                     \
+       $(builddir)/getting_started.xml                 \
        glossary.xml                            \
        gtk3-demo-application.xml               \
        gtk3-demo.xml                           \
@@ -324,7 +324,7 @@ content_files =                                     \
 expand_content_files =                                 \
        compiling.sgml                          \
        drawing-model.xml                       \
-       getting_started.xml                     \
+       $(builddir)/getting_started.xml                 \
        glossary.xml                            \
        input-handling.xml                      \
        migrating-2to3.xml                      \
@@ -496,7 +496,7 @@ endif
 include $(top_srcdir)/gtk-doc.make
 
 # Other files to distribute
-EXTRA_DIST += version.xml.in gtk3.types.in
+EXTRA_DIST += version.xml.in gtk3.types.in getting_started.xml.in
 
 ########################################################################
 
diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml.in
similarity index 92%
rename from docs/reference/gtk/getting_started.xml
rename to docs/reference/gtk/getting_started.xml.in
index 30cd88387d..efa604c862 100644
--- a/docs/reference/gtk/getting_started.xml
+++ b/docs/reference/gtk/getting_started.xml.in
@@ -44,7 +44,7 @@
 
     <informalexample>
       <para>Create a new file with the following content named <filename>example-0.c.</filename></para>
-      <programlisting><xi:include href="../../../../examples/window-default.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/window-default.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </informalexample>
 
     <para>
@@ -153,7 +153,7 @@
     <example id="gtk-getting-started-hello-world">
       <title>Hello World in GTK+</title>
       <para>Create a new file with the following content named example-1.c.</para>
-      <programlisting><xi:include href="../../../../examples/hello-world.c" parse="text">
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/hello-world.c" parse="text">
           <xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
 
@@ -233,7 +233,7 @@
     <example id="gtk-getting-started-grid-packing">
       <title>Packing buttons</title>
       <para>Create a new file with the following content named example-2.c.</para>
-      <programlisting><xi:include href="../../../../examples/grid-packing.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/grid-packing.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
@@ -257,9 +257,9 @@
     <example>
       <title>Packing buttons with GtkBuilder</title>
       <para>Create a new file with the following content named example-3.c.</para>
-      <programlisting><xi:include href="../../../../examples/builder.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/builder.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       <para>Create a new file with the following content named builder.ui.</para>
-      <programlisting><xi:include href="../../../../examples/builder.ui" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/builder.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
@@ -346,7 +346,7 @@
       of our application class.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/main.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application1/main.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>All the application logic is in the application class, which
@@ -364,7 +364,7 @@
       GIO <ulink 
url="https://developer.gnome.org/gio/2.36/GApplication.html#GApplication.description";>documentation</ulink>.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/exampleapp.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application1/exampleapp.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Another important class that is part of the application support
@@ -373,7 +373,7 @@
       window.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/exampleappwin.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application1/exampleappwin.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>As part of the initial setup of our application, we also
@@ -388,7 +388,7 @@
       </informalfigure>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application1/exampleapp.desktop" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application1/exampleapp.desktop" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Note that <replaceable>@<!-- -->bindir@</replaceable> needs to be replaced
@@ -420,7 +420,7 @@
       </para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application2/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application2/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To make use of this file in our application, we revisit
@@ -460,7 +460,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
       </para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application2/exampleapp.gresource.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application2/exampleapp.gresource.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>This file has to be converted into a C source file that will be
@@ -598,7 +598,7 @@ example_app_window_open (ExampleAppWindow *win,
       in a ui file, and add it as a resource to our binary.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application4/app-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application4/app-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To associate the app menu with the application, we have to call
@@ -697,7 +697,7 @@ example_app_class_init (ExampleAppClass *class)
       GSettings requires a schema that describes our settings:</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application5/org.gtk.exampleapp.gschema.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include 
href="@abs_top_srcdir@/examples/application5/org.gtk.exampleapp.gschema.xml" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Before we can make use of this schema in our application,
@@ -749,13 +749,13 @@ example_app_window_init (ExampleAppWindow *win)
       <para>Lets start with the template.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application6/prefs.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application6/prefs.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Next comes the dialog subclass.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application6/exampleappprefs.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application6/exampleappprefs.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Now we revisit the <literal>preferences_activated(<!-- -->)</literal> function in our
@@ -807,7 +807,7 @@ preferences_activated (GSimpleAction *action,
       to slide out the search bar below the header bar.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application7/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application7/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>Implementing the search needs quite a few code changes that
@@ -887,7 +887,7 @@ example_app_window_init (ExampleAppWindow *win)
       which demonstrates #GtkMenuButton, #GtkRevealer and #GtkListBox.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application8/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application8/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>The code to populate the sidebar with buttons for the words
@@ -898,7 +898,7 @@ example_app_window_init (ExampleAppWindow *win)
       ui file.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application8/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application8/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To connect the menuitem to the show-words setting, we use
@@ -957,7 +957,7 @@ example_app_window_init (ExampleAppWindow *win)
       triggers the show-lines action:</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application9/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application9/gears-menu.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>To make this menu item do something, we create a property
@@ -1017,7 +1017,7 @@ example_app_window_init (ExampleAppWindow *win)
       be a direct child of the window, and set its type to be titlebar.</para>
 
       <informalexample>
-        <programlisting><xi:include href="../../../../examples/application10/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+        <programlisting><xi:include href="@abs_top_srcdir@/examples/application10/window.ui" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
       </informalexample>
 
       <para>A small extra bonus of using a header bar is that we get
@@ -1073,7 +1073,7 @@ example_app_window_init (ExampleAppWindow *win)
     <example id="gtk-getting-started-drawing">
       <title>Drawing in response to input</title>
       <para>Create a new file with the following content named example-4.c.</para>
-      <programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>MISSING 
XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
+      <programlisting><xi:include href="@abs_top_srcdir@/examples/drawing.c" 
parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
     </example>
     <para>
       You can compile the program above with GCC using:
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index 3e8c50d971..892e272301 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -383,12 +383,8 @@ content_files = [
   'broadway.xml',
   'broadwayd.xml',
   'building.sgml',
-  'compiling.sgml',
   'css-overview.xml',
   'css-properties.xml',
-  'drawing-model.xml',
-  'getting_started.xml',
-  'glossary.xml',
   'gtk3-demo-application.xml',
   'gtk3-demo.xml',
   'gtk3-icon-browser.xml',
@@ -399,22 +395,11 @@ content_files = [
   'gtk-query-immodules-3.0.xml',
   'gtk-query-settings.xml',
   'gtk-update-icon-cache.xml',
-  'input-handling.xml',
-  'migrating-2to3.xml',
-  'migrating-3xtoy.xml',
-  'migrating-checklist.sgml',
-  'migrating-GtkGrid.xml',
-  'migrating-GtkStyleContext.xml',
-  'migrating-smclient-GtkApplication.xml',
-  'migrating-unique-GtkApplication.xml',
   'mir.xml',
   'osx.sgml',
   'overview.xml',
-  'question_index.sgml',
   'resources.sgml',
   'running.sgml',
-  'text_widget.sgml',
-  'tree_widget.sgml',
   'visual_index.xml',
   'wayland.xml',
   'windows.sgml',
@@ -424,7 +409,7 @@ content_files = [
 expand_content_files = [
   'compiling.sgml',
   'drawing-model.xml',
-  'getting_started.xml',
+  join_paths(meson.current_build_dir(), 'getting_started.xml'),
   'glossary.xml',
   'input-handling.xml',
   'migrating-2to3.xml',
@@ -439,6 +424,8 @@ expand_content_files = [
   'tree_widget.sgml',
 ]
 
+content_files += expand_content_files
+
 types_conf = configuration_data()
 if os_win32
   types_conf.set('DISABLE_ON_W32', '%')
@@ -461,6 +448,7 @@ endif
 if get_option('documentation')
 
     configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
+    configure_file(input: 'getting_started.xml.in', output: 'getting_started.xml', configuration: 
src_dir_conf)
 
     gnome.gtkdoc('gtk3',
                  mode: 'none',
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 23c4e22367..daec53a847 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -14,7 +14,7 @@ if get_option('documentation')
     version_conf.set('GTK_VERSION', meson.project_version())
 
     src_dir_conf = configuration_data()
-    src_dir_conf.set('SRC_DIR', meson.source_root())
+    src_dir_conf.set('abs_top_srcdir', meson.source_root())
 endif
 
 subdir('gdk')


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