On Wed, Apr 11, 2018 at 06:04:26PM +0100, Emmanuele Bassi wrote:
> Hi Jonas;
> 
> On 11 April 2018 at 17:45, Jonas Ådahl <jad...@gmail.com> wrote:
> 
> > FWIW, I did something similar, here:
> > https://lists.freedesktop.org/archives/wayland-devel/2017-
> > October/035399.html
> > because I wanted to add build tests. IIRC there is some bug that I only
> > fixed locally.
> >
> >
> Yes, I was planning to reference the work you did in the cover letter for
> this patch, but git-send-email is terrible.
> 
> I honestly didn't look at your patchset before doing this work — and, to be
> fair, I did this over my lunch break, so I didn't really get into doing
> anything more than a mechanical port.
> 
> I'd be happy to improve the build by merging my approach and yours. My
> patch is slightly more idiomatic with regards to recent Meson; it allows
> using wayland-protocols as a subproject, as it doesn't use
> `meson.source_root()` in paths; and it generates the pkg-config file
> directly instead of going through a template file.

That'd be great. Mostly what I care about is being able to run the build
tests, but not during the "configure" part, as that resulted in too much
"spam" effectively hiding any useful information one might wanted to
have seen. IIRC it needed some tricks to make that work.

> 
> I did leave the Autotools build in place because I don't know if people
> using wayland-protocols can also rely on having a recent version of Meson
> and Python 3.

Yea, might have been a bit too eager regarding the removal, I'd be fine
with leaving autotools there for a while.


Jonas

> 
> Ciao,
>  Emmanuele.
> 
> On Wed, Apr 11, 2018 at 05:27:49PM +0100, Emmanuele Bassi wrote:
> > > From: Emmanuele Bassi <eba...@gnome.org>
> > >
> > > Meson is a next generation build system, and various projects in the
> > > larger Linux ecosystem already moved to it — for instance:
> > >
> > >   - the X11 server
> > >   - the X11 protocols repository
> > >   - Mesa
> > >   - libdrm
> > >
> > > The added benefit for adding Meson support is that projects using Meson
> > > and depending on wayland-protocols can use the subproject functionality
> > > to always pull the latest version of the protocols without necessarily
> > > updating their build environment.
> > > ---
> > >  meson.build       | 89 +++++++++++++++++++++++++++++++++++++++++++++++
> > >  meson_options.txt |  5 +++
> > >  2 files changed, 94 insertions(+)
> > >  create mode 100644 meson.build
> > >  create mode 100644 meson_options.txt
> > >
> > > diff --git a/meson.build b/meson.build
> > > new file mode 100644
> > > index 0000000..c078ff3
> > > --- /dev/null
> > > +++ b/meson.build
> > > @@ -0,0 +1,89 @@
> > > +project('wayland-protocols', 'c',
> > > +  version: '1.13',
> > > +  license: 'MIT',
> > > +  meson_version: '>= 0.45.0',
> > > +)
> > > +
> > > +wayland_scanner_dep = dependency('wayland-scanner', required: false)
> > > +wayland_scanner_opt = get_option('wayland_scanner')
> > > +wayland_scanner_bin = ['wayland-scanner']
> > > +
> > > +if wayland_scanner_opt != ''
> > > +  wayland_scanner_bin += wayland_scanner_opt
> > > +endif
> > > +
> > > +if wayland_scanner_dep.found()
> > > +  wayland_scanner_bin += wayland_scanner_dep.get_
> > pkgconfig_variable('wayland_scanner')
> > > +endif
> > > +
> > > +wayland_scanner = find_program(wayland_scanner_bin)
> > > +
> > > +pkgdatadir = join_paths(get_option('datadir'), meson.project_name())
> > > +
> > > +protocol_files = []
> > > +
> > > +# name, [version, ...]
> > > +unstable_protocols = [
> > > +  [ 'pointer-gestures', ['v1',], ],
> > > +  [ 'fullscreen-shell', ['v1',], ],
> > > +  [ 'linux-dmabuf', ['v1',], ],
> > > +  [ 'text-input', ['v1',], ],
> > > +  [ 'input-method', ['v1',], ],
> > > +  [ 'xdg-shell', ['v5', 'v6',], ],
> > > +  [ 'relative-pointer', ['v1',], ],
> > > +  [ 'pointer-constraints', ['v1',], ],
> > > +  [ 'tablet', ['v1', 'v2',], ],
> > > +  [ 'xdg-foreign', ['v1', 'v2',], ],
> > > +  [ 'idle-inhibit', ['v1',], ],
> > > +  [ 'xwayland-keyboard-grab', ['v1',], ],
> > > +  [ 'keyboard-shortcuts-inhibit', ['v1',], ],
> > > +  [ 'xdg-output', ['v1',], ],
> > > +  [ 'input-timestamps', ['v1',], ],
> > > +]
> > > +
> > > +foreach p: unstable_protocols
> > > +  p_name = p[0]
> > > +  p_versions = p[1]
> > > +  foreach version: p_versions
> > > +    xml_file = join_paths('unstable', p_name, '@0@-unstable-@1
> > @.xml'.format(p_name, version))
> > > +    protocol_files += [[p_name, files(xml_file)]]
> > > +    install_data(xml_file, install_dir: join_paths(pkgdatadir,
> > 'unstable', p_name))
> > > +  endforeach
> > > +endforeach
> > > +
> > > +stable_protocols = [
> > > +  'presentation-time',
> > > +  'viewporter',
> > > +  'xdg-shell',
> > > +]
> > > +
> > > +foreach p_name: stable_protocols
> > > +  xml_file = join_paths('stable', p_name, '@0@.xml'.format(p_name))
> > > +  protocol_files += [[p_name, files(xml_file)]]
> > > +  install_data(xml_file, install_dir: join_paths(pkgdatadir, 'stable',
> > p_name))
> > > +endforeach
> > > +
> > > +pkgconfig = import('pkgconfig')
> > > +pkgconfig.generate(
> > > +  name: meson.project_name(),
> > > +  description: 'Wayland protocol files',
> > > +  version: meson.project_version(),
> > > +  variables: [
> > > +    'datarootdir=${prefix}/@0@'.format(get_option('datadir')),
> > > +    'pkgdatadir=${pc_sysrootdir}${datarootdir}/@0@'.format(
> > meson.project_name()),
> > > +  ],
> > > +  install_dir: join_paths(get_option('datadir'), 'pkgconfig'),
> > > +)
> > > +
> > > +scan_test = find_program('tests/scan.sh')
> > > +foreach p: protocol_files
> > > +  p_name = p[0]
> > > +  p_file = p[1]
> > > +  test('verify ' + p_name,
> > > +    scan_test,
> > > +    args: [ p_file, ],
> > > +    env: [
> > > +      'SCANNER=@0@'.format(wayland_scanner.path()),
> > > +    ],
> > > +  )
> > > +endforeach
> > > diff --git a/meson_options.txt b/meson_options.txt
> > > new file mode 100644
> > > index 0000000..09a8618
> > > --- /dev/null
> > > +++ b/meson_options.txt
> > > @@ -0,0 +1,5 @@
> > > +option('wayland_scanner',
> > > +  description: 'The wayland-scanner binary to use',
> > > +  type: 'string',
> > > +  value: ''
> > > +)
> > > --
> > > 2.17.0
> > >
> > > _______________________________________________
> > > wayland-devel mailing list
> > > wayland-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
> 
> 
> 
> -- 
> https://www.bassi.io
> [@] ebassi [@gmail.com]
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to