Re: [osinfo-db-tools PATCH 2/8] Add support to meson build system

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

 



On Thu, Jun 20, 2019 at 05:21:21PM +0200, Fabiano Fidêncio wrote:
> Meson build system is a way simpler and easier to understand build
> system that can provide (with some work-arounds here and there) the same
> functionalities currently available with our current build system
> (autotools).
> 
> For now, as meson support is not fully complete* and requires a quite
> new version of meson still not present in all systems supported on
> libvirt-jenkis-ci, let's keep autotools around so more extensive testing
> if meson's functionalities can be done before actually removing
> autotools support.


> *: the support is not fully complete as there's still no equivalent of
> `make syntax-check` provided.

....from here onwards..

> 
> A quite nice description of meson, ninja, and their workflow was part of
> the spice* commits introducing support to meson/ninja and is copied
> below:
> ```
> - Meson: https://mesonbuild.com
> 
>   This is the equivalent of autogen/configure step in autotools. It
>   generates the files that will be used by ninja to actually build the
>   source code.
> 
>   The project has received lots of traction recently, with many GNOME
>   projects willing to move to this new build system. The following wiki
>   page has more details of the status of the many projects being ported:
> 
>     https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
> 
>   Meson has a python-like syntax, easy to read, and the documentation
>   on the project is very complete, with a dedicated page on how to port
>   from autotools, explaining how most common use cases can be
>   implemented using meson.
> 
>     http://mesonbuild.com/Porting-from-autotools.html
> 
>   Other important sources of information:
> 
>     http://mesonbuild.com/howtox.html
>     http://mesonbuild.com/Syntax.html
>     http://mesonbuild.com/Reference-manual.html
> 
> - Ninja: https://ninja-build.org
> 
>   Ninja is the equivalent of make in an autotools setup, which actually
>   builds the source code. It has being used by large and complex
>   projects such as Google Chrome, Android and LLVM. There is not much to
>   say about ninja (other than it is much faster than make) because we
>   won't interact directly with it as much, as meson does the middle man
>   job here. The reasoning for creating ninja in the first place is
>   explained on the following post:
> 
>     http://neugierig.org/software/chromium/notes/2011/02/ninja.html
> 
>   Also its manual provides more in-depth information about the design
>   principles:
> 
>     https://ninja-build.org/manual.html
> 
> - Basic workflow:
> 
>   Meson package is available for most if not all distros, so, taking
>   Fedora as an example, we only need to run:
> 
>     # dnf -y install meson ninja-build.
> 
>   With Meson, building in-tree is not possible at all, so we need to
>   pass a directory as argument to meson where we want the build to be
>   done. This has the advantage of creating builds with different options
>   under the same parent directory, e.g.:
> 
>     $ meson ./build --prefix=/usr
>     $ meson ./build-extra -Dextra-checks=true -Dalignment-checks=true
> 
>   After configuration is done, we call ninja to actually do the build.
> 
>     $ ninja -C ./build
>     $ ninja -C ./build install
> 
> - Hacking:
> 
>   * meson.build: Mandatory for the project root and usually found under
>                  each directory you want something to be built.
> ```

can probably be in the cover letter. Instructions for actually building
probably belong in the README file.

> 
> Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
> ---
>  build-aux/dist.sh |   8 ++
>  meson.build       |  40 +++++++
>  po/meson.build    |   2 +
>  tests/meson.build |  21 ++++
>  tools/meson.build | 271 ++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 342 insertions(+)
>  create mode 100755 build-aux/dist.sh
>  create mode 100644 meson.build
>  create mode 100644 po/meson.build
>  create mode 100644 tests/meson.build
>  create mode 100644 tools/meson.build
> 
> diff --git a/build-aux/dist.sh b/build-aux/dist.sh
> new file mode 100755
> index 0000000..f2a4bc6
> --- /dev/null
> +++ b/build-aux/dist.sh
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +
> +SOURCE_ROOT=$1
> +
> +$SOURCE_ROOT/build-aux/gitlog-to-changelog > $MESON_DIST_ROOT/ChangeLog
> +
> +out="`git log --pretty=format:'%aN <%aE>' | sort -u`"
> +perl -p -e "s/#authorslist#// and print '$out'" < $SOURCE_ROOT/AUTHORS.in > $MESON_DIST_ROOT/AUTHORS
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..a057dfa
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,40 @@
> +project(
> +    'osinfo-db-tools', 'c',
> +    version: '1.6.0',
> +    license: 'GPLv2+',
> +    meson_version: '>= 0.49.0'

The 'dist.sh' script is the main reason for this min version i see.
Were there any others ?


> +)
> +
> +osinfo_db_tools_prefix = get_option('prefix')
> +
> +# those directories have to be known by the project
> +osinfo_db_tools_datadir = join_paths(osinfo_db_tools_prefix, get_option('datadir'))
> +osinfo_db_tools_localedir = join_paths(osinfo_db_tools_prefix, get_option('localedir'))
> +osinfo_db_tools_pkgdatadir = join_paths(osinfo_db_tools_datadir, meson.project_name())
> +osinfo_db_tools_sysconfdir = join_paths(osinfo_db_tools_prefix, get_option('sysconfdir'))
> +
> +# those directories will have files installed in
> +osinfo_db_tools_bindir = join_paths(osinfo_db_tools_prefix, get_option('bindir'))
> +osinfo_db_tools_docdir = join_paths(osinfo_db_tools_datadir, 'doc', meson.project_name())
> +osinfo_db_tools_licensedir = join_paths(osinfo_db_tools_datadir, 'license', meson.project_name())
> +osinfo_db_tools_mandir = join_paths(osinfo_db_tools_prefix, get_option('mandir'))
> +
> +# spec files
> +osinfo_db_tools_spec_data = configuration_data()
> +osinfo_db_tools_spec_data.set('VERSION', meson.project_version())
> +
> +specs = ['osinfo-db-tools.spec', 'mingw-osinfo-db-tools.spec']
> +foreach spec: specs
> +    configure_file(
> +        input: spec + '.in',
> +        output: spec,
> +        configuration: osinfo_db_tools_spec_data
> +    )
> +endforeach
> +
> +# ninja dist helper
> +meson.add_dist_script('build-aux/dist.sh', meson.source_root())
> +
> +subdir('tools')
> +subdir('po')
> +subdir('tests')

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux