Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for meson build system #57

Merged
merged 7 commits into from
Mar 19, 2018
Merged

add support for meson build system #57

merged 7 commits into from
Mar 19, 2018

Conversation

Cogitri
Copy link
Contributor

@Cogitri Cogitri commented Mar 10, 2018

This PR adds support for meson to playerctl. It works fine for everything but gtk-doc for me, still messing with that

@@ -0,0 +1,2 @@
#option('gtk-doc', type: 'boolean', value: false, description: 'build docs')
option('introspection', type: 'boolean', value: false, description: 'build gir data')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be generated by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright :)

@acrisci
Copy link
Member

acrisci commented Mar 11, 2018

Cool, you can remove the old build system when you are done 👍 .

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 11, 2018

IMO it makes sense to keep the old one for at least one release, just in case something is broken with the meson implementation after all :)

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 12, 2018

Okay, I've added the stuff I've done so far for gtk-doc, but it still fails ( although I think that I've copied everything from Makefile.am )

Full logs:

Configuration:

The Meson build system
Version: 0.44.1
Source dir: /home/rasmus/Downloads/playerctl
Build dir: /home/rasmus/Downloads/playerctl/build
Build type: native build
Project name: playerctl
Native C compiler: cc (gcc 7.3.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/host/bin/pkg-config (1.4.1)
Native dependency gobject-2.0 found: YES 2.54.3
Native dependency gio-unix-2.0 found: YES 2.54.3
Configuring playerctl-version.h using configuration
Program gdbus-codegen found: YES (/usr/host/bin/gdbus-codegen)
Native dependency glib-2.0 found: YES 2.54.3
Program g-ir-scanner found: YES (/usr/host/bin/g-ir-scanner)
Program g-ir-compiler found: YES (/usr/host/bin/g-ir-compiler)
Native dependency gobject-introspection-1.0 found: YES 1.54.1
Program gtkdoc-scan found: YES (/usr/host/bin/gtkdoc-scan)
Native dependency glib-2.0 found: YES 2.54.3
Configuring version.xml using configuration
Build targets in project: 7
Found ninja-1.8.2 at /usr/host/bin/ninja

Building:

ninja: Entering directory `build'
[2/13] Compiling C object 'playerctl/playerctl@exe/playerctl-cli.c.o'.
../playerctl/playerctl-cli.c: In function 'handle_player_command':
../playerctl/playerctl-cli.c:280:55: warning: too many arguments for format [-Wformat-extra-args]
   g_set_error(error, playerctl_cli_error_quark (), 1, "Command not recognized: %s", command[0], NULL);
                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[3/13] Compiling C object 'playerctl/playerctl-1.0@sha/playerctl-player.c.o'.
../playerctl/playerctl-player.c: In function 'playerctl_player_properties_changed_callback':
../playerctl/playerctl-player.c:68:31: warning: variable 'proxy' set but not used [-Wunused-but-set-variable]
   OrgMprisMediaPlayer2Player *proxy;
                               ^~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_artist':
../playerctl/playerctl-player.c:768:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_title':
../playerctl/playerctl-player.c:793:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_album':
../playerctl/playerctl-player.c:818:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
[4/13] Compiling C object 'playerctl/playerctl-1.0@sta/playerctl-player.c.o'.
../playerctl/playerctl-player.c: In function 'playerctl_player_properties_changed_callback':
../playerctl/playerctl-player.c:68:31: warning: variable 'proxy' set but not used [-Wunused-but-set-variable]
   OrgMprisMediaPlayer2Player *proxy;
                               ^~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_artist':
../playerctl/playerctl-player.c:768:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_title':
../playerctl/playerctl-player.c:793:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
../playerctl/playerctl-player.c: In function 'playerctl_player_get_album':
../playerctl/playerctl-player.c:818:11: warning: unused variable 'tmp_error' [-Wunused-variable]
   GError *tmp_error = NULL;
           ^~~~~~~~~
[11/13] Generating Playerctl-1.0.gir with a custom command.
g-ir-scanner: link: cc -o /home/rasmus/Downloads/playerctl/build/tmp-introspectnb6vffsq/Playerctl-1.0 /home/rasmus/Downloads/playerctl/build/tmp-introspectnb6vffsq/Playerctl-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -lplayerctl-1.0 -lglib-2.0 -lgobject-2.0 -lgio-2.0 -L/home/rasmus/Downloads/playerctl/build/playerctl -Wl,-rpath,/home/rasmus/Downloads/playerctl/build/playerctl -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
[12/13] Installing files.
Installing playerctl/libplayerctl-1.0.so.0.0.0 to /home/rasmus/Downloads/playerctl/install/usr/local/lib/libplayerctl-1.0.so.0.0.0
Installing playerctl/libplayerctl-1.0.a to /home/rasmus/Downloads/playerctl/install/usr/local/lib/libplayerctl-1.0.a
Installing playerctl/playerctl to /home/rasmus/Downloads/playerctl/install/usr/local/bin/playerctl
Installing playerctl/Playerctl-1.0.gir to /home/rasmus/Downloads/playerctl/install/usr/local/share/gir-1.0/Playerctl-1.0.gir
Installing playerctl/Playerctl-1.0.typelib to /home/rasmus/Downloads/playerctl/install/usr/local/lib/girepository-1.0/Playerctl-1.0.typelib
Installing playerctl.h to /home/rasmus/Downloads/playerctl/install/usr/local/include/playerctl
Installing playerctl-player.h to /home/rasmus/Downloads/playerctl/install/usr/local/include/playerctl
Installing playerctl-version.h to /home/rasmus/Downloads/playerctl/install/usr/local/include/playerctl
Installing /home/rasmus/Downloads/playerctl/build/meson-private/playerctl.pc to /home/rasmus/Downloads/playerctl/install/usr/local/lib/pkgconfig
Running custom install script '/usr/x86_64-pc-linux-gnu/bin/python3.6 /usr/host/bin/meson --internal gtkdoc --sourcedir=/home/rasmus/Downloads/playerctl --builddir=/home/rasmus/Downloads/playerctl/build --subdir=doc/reference --headerdirs=playerctl --mainfile=playerctl-docs.xml --modulename=playerctl --mode=auto --scanargs=--deprecated-guards="PLAYERCTL_DISABLE_DEPRECATED" --fixxrefargs=--extra-dir=/usr/share/gtk-doc/html/gobject@@--extra-dir=/usr/share/gtk-doc/html/gio@@--extra-dir=/usr/share/gtk-doc/html/glib --mkdbargs=--sgml-mode@@--output-format=xml@@--name-space=playerctl --ignore-headers=playerctl.h@@playerctl-version.h --cflags=-I/usr/x86_64-pc-linux-gnu/include/glib-2.0 -I/usr/x86_64-pc-linux-gnu/lib/glib-2.0/include --ldflags=-lgobject-2.0 -lglib-2.0 --cc=cc --ld=cc'
Building documentation for playerctl

Error in gtkdoc helper script:
'gtkdoc-mkhtml' failed with status 6
Failed to run install script '/usr/x86_64-pc-linux-gnu/bin/python3.6 /usr/host/bin/meson --internal gtkdoc --sourcedir=/home/rasmus/Downloads/playerctl --builddir=/home/rasmus/Downloads/playerctl/build --subdir=doc/reference --headerdirs=playerctl --mainfile=playerctl-docs.xml --modulename=playerctl --mode=auto --scanargs=--deprecated-guards="PLAYERCTL_DISABLE_DEPRECATED" --fixxrefargs=--extra-dir=/usr/share/gtk-doc/html/gobject@@--extra-dir=/usr/share/gtk-doc/html/gio@@--extra-dir=/usr/share/gtk-doc/html/glib --mkdbargs=--sgml-mode@@--output-format=xml@@--name-space=playerctl --ignore-headers=playerctl.h@@playerctl-version.h --cflags=-I/usr/x86_64-pc-linux-gnu/include/glib-2.0 -I/usr/x86_64-pc-linux-gnu/lib/glib-2.0/include --ldflags=-lgobject-2.0 -lglib-2.0 --cc=cc --ld=cc'
FAILED: meson-install 
/usr/x86_64-pc-linux-gnu/bin/python3.6 /usr/host/bin/meson --internal install /home/rasmus/Downloads/playerctl/build/meson-private/install.dat
ninja: build stopped: subcommand failed.

The actual error message by gtk-doc:

warning: failed to load external entity "../xml/tree_index.sgml"
../playerctl-docs.xml:25: element include: XInclude error : could not load ../xml/tree_index.sgml, and no fallback was found

@acrisci
Copy link
Member

acrisci commented Mar 12, 2018

Did you run gtkdocize on the project? That might fix it.

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 12, 2018

Just tried it, exactly the same happens ( and gtk-doc.m4 doesn't contain anything that's not set in the respective meson.build file, I think )

@acrisci
Copy link
Member

acrisci commented Mar 12, 2018

The source of the problem seems to be in the playerctl-docs.xml file. It's trying to load resources that were assumed to be generated before that aren't being generated now.

  <chapter id="object-tree">
    <title>Object Hierarchy</title>
     <xi:include href="xml/tree_index.sgml"/>
  </chapter>
  <index id="api-index-full">
    <title>API Index</title>
    <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
  </index>
  <index id="deprecated-api-index" role="deprecated">
    <title>Index of deprecated API</title>
    <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
  </index>

Look at this example for how to do gtkdoc and try to do what they do and let me know how it goes.

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 15, 2018

Okay, seems like I've figured that one out, forgot to generate the GIR related docs

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 15, 2018

Okay, it almost works now, I only have to figure out how to link against the shared library that's built and then everything should be set

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 17, 2018

Everything should work now :)

Please squash the commits before merging, I just like to use fixup commits on github, so that one can track what actually changed in the PR :)

@acrisci
Copy link
Member

acrisci commented Mar 17, 2018

How do you make the docs?

?meson ~/projects/playerctl> ninja -C build playerctl-doc 
ninja: Entering directory `build'
[0/1] Running external command playerctl-doc.
Building documentation for playerctl

Error in gtkdoc helper script:
'gtkdoc-mkdb' failed with status 2
usage: gtkdoc-mkdb [-h] [--version] --module MODULE [--source-dir SOURCE_DIR]
                   [--source-suffixes SOURCE_SUFFIXES]
                   [--ignore-files IGNORE_FILES] [--output-dir OUTPUT_DIR]
                   [--tmpl-dir TMPL_DIR] [--main-sgml-file MAIN_SGML_FILE]
                   [--expand-content-files EXPAND_CONTENT_FILES]
                   [--sgml-mode | --xml-mode]
                   [--default-stability {,Stable,Private,Unstable}]
                   [--default-includes DEFAULT_INCLUDES]
                   [--output-format OUTPUT_FORMAT] [--name-space NAME_SPACE]
                   [--outputallsymbols] [--outputsymbolswithoutsince]
gtkdoc-mkdb: error: argument --sgml-mode: not allowed with argument --xml-mode

FAILED: meson-playerctl-doc 
/usr/bin/python3 /usr/bin/meson --internal commandrunner /home/tony/projects/playerctl /home/tony/projects/playerctl/build doc/reference /usr/bin/python3 /usr/bin/meson /usr/bin/python3 /usr/bin/meson --internal gtkdoc --sourcedir=/home/tony/projects/playerctl --builddir=/home/tony/projects/playerctl/build --subdir=doc/reference --headerdirs=/home/tony/projects/playerctl/playerctl --mainfile=playerctl-docs.xml --modulename=playerctl --mode=auto '--scanargs=--deprecated-guards="PLAYERCTL_DISABLE_DEPRECATED"' --gobjects-types-file=playerctl.types --fixxrefargs=--extra-dir=/usr/share/gtk-doc/html/gobject@@--extra-dir=/usr/share/gtk-doc/html/gio@@--extra-dir=/usr/share/gtk-doc/html '--mkdbargs=--sgml-mode@@--output-format=xml@@--name-space=meson.project_name()' --ignore-headers=playerctl.h@@playerctl-generated.h '--cflags=-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gio-unix-2.0/ -pthread' '--ldflags=-lglib-2.0 -L/home/tony/projects/playerctl/build/playerctl -Wl,-rpath,/home/tony/projects/playerctl/build/playerctl -lplayerctl-1.0 -lgobject-2.0 -lgio-2.0' --cc=cc --ld=cc
ninja: build stopped: subcommand failed.
exit 1

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 17, 2018

I simply do them during install:

ninja -C build install

But that shouldn't change anything. It works for me, so I guess one of of us is using an older version of gtk-doc or meson. What versions do you use?

I'm using Meson 0.45 and gtk-doc 1.25 myself

@acrisci
Copy link
Member

acrisci commented Mar 18, 2018

Removing that flag works for me, does it work for you?

diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index c008471..8df2fad 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -14,7 +14,6 @@ gnome.gtkdoc(
     playerctl_shared_link,
   ],
   mkdb_args: [
-    '--sgml-mode',
     '--output-format=xml',
     '--name-space=meson.project_name()',
   ],

@Cogitri
Copy link
Contributor Author

Cogitri commented Mar 18, 2018

Alright, still works. Do mind however that we passed sgml-mode to gtkdoc-mkdb with autotools too. However, the result seems to be the same with meson, no matter if we pass sgml-mode to it or not.

@acrisci
Copy link
Member

acrisci commented Mar 19, 2018

Cool looks good thanks 👍

@acrisci acrisci merged commit 996a08c into altdesktop:master Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants