1
0
Fork 0

build: Add a Meta Toolkit private library

Currently, Meta/Cogl/Clutter makes use of cairo_rectangle_int_t despite
the existance of MetaRectangle.

In order to make MetaRectangle usable in Cogl/Clutter as well, Mtk would
provide such base types that are shared across the various private
libraries

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
This commit is contained in:
Bilal Elmoussaoui 2023-07-18 17:58:47 +02:00
parent ff4d87727b
commit 765a918a62
14 changed files with 256 additions and 1 deletions

View file

@ -637,7 +637,7 @@ reference:
- meson setup . build --werror -Ddocs=true -Dtests=false
- ninja -C build
- mkdir references
- mv build/doc/reference/{cally/cally,clutter/clutter,cogl/cogl,cogl-pango/cogl-pango,meta/meta} references/
- mv build/doc/reference/{cally/cally,clutter/clutter,cogl/cogl,cogl-pango/cogl-pango,meta/meta,mtk/mtk} references/
artifacts:
expire_in: 1 week
expose_as: 'Documentation'

View file

@ -14,6 +14,7 @@ custom_target('cally-doc',
gidocgen,
'generate',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../mtk/mtk'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl-pango'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../clutter/clutter'),
@ -23,6 +24,7 @@ custom_target('cally-doc',
'@INPUT1@',
],
depends: [
libmutter_mtk_gir[0],
libmutter_cogl_gir[0],
libmutter_cogl_pango_gir[0],
libmutter_clutter_gir[0],

View file

@ -14,6 +14,7 @@ custom_target('clutter-doc',
gidocgen,
'generate',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../mtk/mtk'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl-pango'),
'--config=@INPUT0@',
@ -22,6 +23,7 @@ custom_target('clutter-doc',
'@INPUT1@',
],
depends: [
libmutter_mtk_gir[0],
libmutter_cogl_pango_gir[0],
libmutter_cogl_gir[0],
],

View file

@ -25,3 +25,4 @@ subdir('clutter')
subdir('cogl')
subdir('cogl-pango')
subdir('meta')
subdir('mtk')

View file

@ -14,6 +14,7 @@ custom_target('meta-doc',
gidocgen,
'generate',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../mtk/mtk'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../clutter/clutter'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl'),
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../cogl/cogl-pango'),
@ -23,6 +24,7 @@ custom_target('meta-doc',
'@INPUT1@',
],
depends: [
libmutter_mtk_gir[0],
libmutter_clutter_gir[0],
libmutter_cally_gir[0],
libmutter_cogl_pango_gir[0],

View file

@ -0,0 +1,24 @@
mtk_toml = configure_file(
input: 'mtk.toml.in',
output: 'mtk.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'mtk',
)
custom_target('mtk-doc',
input: [ mtk_toml, libmutter_mtk_gir[0] ],
output: 'mtk',
command: [
gidocgen,
'generate',
gidocgen_common_args,
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
build_by_default: true,
install: true,
install_dir: docs_dir,
)

View file

@ -0,0 +1,34 @@
[library]
version = "@version@"
browse_url = "https://gitlab.gnome.org/GNOME/mutter/"
repository_url = "https://gitlab.gnome.org/GNOME/mutter.git"
website_url = "https://blogs.gnome.org/shell-dev/"
docs_url = "https://docs.gtk.org/"
authors = "Mutter Development Team"
license = "GPL-2.0-or-later"
description = "Mutter Toolkit Private Library"
dependencies = [ "GObject-2.0" ]
devhelp = true
search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
[theme]
name = "basic"
show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/mutter/-/blob/@vcs_tag@/"
[extra]
# The same order will be used when generating the index
content_files = [
]
content_images = [
]
urlmap_file = "urlmap.js"

View file

@ -0,0 +1,7 @@
// SPDX-FileCopyrightText: 2021 GNOME Foundation
// SPDX-License-Identifier: LGPL-2.1-or-later
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
]

View file

@ -659,6 +659,7 @@ config_h = configure_file(
top_includepath = include_directories('.')
subdir('mtk')
subdir('cogl')
subdir('clutter')
subdir('data')

39
mtk/meson.build Normal file
View file

@ -0,0 +1,39 @@
mtk_includesubdir = pkgname / 'mtk'
mtk_includedir = includedir / mtk_includesubdir
mtk_includepath = include_directories('.', 'mtk')
mtk_includes = [mtk_includepath]
mtk_c_args = [
'-DMTK_SYSCONFDIR="@0@"'.format(prefix / sysconfdir),
'-DMTK_COMPILATION=1',
'-DG_LOG_DOMAIN="Mtk"',
]
mtk_debug_c_args = []
if get_option('debug')
mtk_debug_c_args += [
'-fno-omit-frame-pointer'
]
elif buildtype != 'plain'
mtk_debug_c_args += [
'-DG_DISABLE_ASSERT',
'-DG_DISABLE_CAST_CHECKS',
]
endif
supported_mtk_debug_c_args = cc.get_supported_arguments(mtk_debug_c_args)
mtk_c_args += mtk_debug_c_args
mtk_pkg_deps = [
cairo_gobject_dep,
glib_dep,
gobject_dep,
gio_dep,
]
mtk_deps = [
mtk_pkg_deps,
m_dep
]
subdir('mtk')

81
mtk/mtk/meson.build Normal file
View file

@ -0,0 +1,81 @@
mtk_mtk_includesubdir = mtk_includesubdir / 'mtk'
mtk_headers = [
'mtk.h',
'mtk-macros.h',
]
mtk_sources = [
]
mtk_private_headers = [
]
libmutter_mtk_name = 'mutter-mtk-' + libmutter_api_version
libmutter_mtk = shared_library(libmutter_mtk_name,
sources: [
mtk_sources,
mtk_headers,
mtk_private_headers,
],
version: '0.0.0',
soversion: 0,
c_args: mtk_c_args,
include_directories: mtk_includes,
dependencies: [mtk_deps],
gnu_symbol_visibility: 'hidden',
install_rpath: pkglibdir,
install_dir: pkglibdir,
install: true,
)
libmutter_mtk_dep = declare_dependency(
link_with: libmutter_mtk,
dependencies: mtk_deps,
)
if have_introspection
mtk_introspection_args = introspection_args + [
'-DMTK_SYSCONFDIR="@0@"'.format(prefix / sysconfdir),
'-DMTK_COMPILATION=1',
'-DCOGL_DISABLE_DEPRECATION_WARNINGS',
'-DG_LOG_DOMAIN="Mtk"'
]
libmutter_mtk_gir = gnome.generate_gir(libmutter_mtk,
sources: [
mtk_sources,
mtk_headers,
],
nsversion: libmutter_api_version,
namespace: 'Mtk',
export_packages: [libmutter_mtk_name],
includes: [
'GObject-2.0',
'cairo-1.0',
],
extra_args: mtk_introspection_args + ['--c-include=mtk/mtk.h'],
install_dir_gir: pkglibdir,
install_dir_typelib: pkglibdir,
install: true,
)
endif
install_headers(mtk_headers,
subdir: mtk_mtk_includesubdir)
pkg.generate(libmutter_mtk,
name: 'Mutter Toolkit',
filebase: libmutter_mtk_name,
description: 'Mutter Toolkit Private Library',
libraries: [m_dep],
subdirs: pkgname / 'mtk',
requires: [mtk_pkg_deps],
version: meson.project_version(),
variables: [
'apiversion=' + libmutter_api_version,
],
install_dir: pcdir,
)

33
mtk/mtk/mtk-macros.h Normal file
View file

@ -0,0 +1,33 @@
/*
* Mtk
*
* A low-level base library.
*
* Copyright (C) 2023 Red Hat
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined(__MTK_H_INSIDE__) && !defined(MTK_COMPILATION)
#error "Only <mtk/mtk.h> can be included directly."
#endif
#define MTK_EXPORT __attribute__((visibility ("default"))) extern
/* MTK_EXPORT_TEST should be used to export symbols that are exported only
* for testability purposes
*/
#define MTK_EXPORT_TEST MTK_EXPORT

28
mtk/mtk/mtk.h Normal file
View file

@ -0,0 +1,28 @@
/*
* Mtk
*
* A low-level base library.
*
* Copyright (C) 2023 Red Hat
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define __MTK_H_INSIDE__
#include "mtk/mtk-macros.h"
#undef __MTK_H_INSIDE__

View file

@ -86,6 +86,7 @@ if have_introspection
'GDesktopEnums-3.0',
'xlib-2.0',
'xfixes-4.0',
libmutter_mtk_gir[0],
libmutter_cogl_gir[0],
libmutter_cogl_pango_gir[0],
libmutter_clutter_gir[0],