[gnome-desktop/ebassi/update-for-gtk4] Add libgnome-desktop-4



commit ef47c54b726c661c46022764e8a288758887c38b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Oct 29 15:47:03 2021 +0100

    Add libgnome-desktop-4
    
    For GNOME components using GTK 4, we provide a base library that does
    not depend on GTK, libgnome-desktop-4, with the bits that do not use GDK
    or GTK.
    
    This library has a new soname and version, as well as a new pkg-config
    file and introspection data files.
    
    We want to keep libgnome-desktop-3 as a legacy library for GNOME
    components (and some applications) that still use GTK 3; for this
    reason, libgnome-desktop-3 will not change.

 libgnome-desktop/base-symbol.map |   6 ++
 libgnome-desktop/meson.build     | 192 +++++++++++++++++++++++++++++++++------
 meson.build                      |  32 +------
 3 files changed, 176 insertions(+), 54 deletions(-)
---
diff --git a/libgnome-desktop/base-symbol.map b/libgnome-desktop/base-symbol.map
new file mode 100644
index 00000000..671c1560
--- /dev/null
+++ b/libgnome-desktop/base-symbol.map
@@ -0,0 +1,6 @@
+{
+global:
+  gnome_*;
+local:
+  *;
+};
diff --git a/libgnome-desktop/meson.build b/libgnome-desktop/meson.build
index 03dcc9ce..9931db26 100644
--- a/libgnome-desktop/meson.build
+++ b/libgnome-desktop/meson.build
@@ -9,6 +9,149 @@ libargs = [
   '-DXKB_BASE="@0@"'.format(xkb_base)
 ]
 
+conf = configuration_data()
+
+conf.set_quoted('GETTEXT_PACKAGE', '@0@-3.0'.format(meson.project_name()))
+conf.set_quoted('INSTALL_PREFIX', prefix)
+
+conf.set('ENABLE_SECCOMP', seccomp_dep.found())
+conf.set('HAVE_BWRAP', seccomp_dep.found())
+conf.set('_GNU_SOURCE', seccomp_dep.found())
+
+conf.set('HAVE_SYSTEMD', libsystemd_dep.found())
+conf.set('HAVE_UDEV', udev_dep.found())
+conf.set('HAVE_XKBREGISTRY', xkbregistry_dep.found())
+
+conf.set('HAVE_TIMERFD', cc.has_function('timerfd_create'))
+conf.set('HAVE_OPENAT', cc.has_function('openat'))
+conf.set('HAVE_USELOCALE', cc.has_function('uselocale'))
+conf.set('HAVE_XLOCALE', cc.has_header('xlocale.h'))
+
+configure_file(
+  output: 'config.h',
+  configuration: conf,
+)
+
+dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
+  'xrandr.xml',
+  namespace: 'MetaDBus',
+  interface_prefix: 'org.gnome.Mutter'
+)
+
+dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
+  'idle-monitor.xml',
+  namespace: 'MetaDBus',
+  interface_prefix: 'org.gnome.Mutter',
+  object_manager: true
+)
+
+### gnome-desktop-base
+base_ldflags = []
+base_symbol_map = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'base-symbol.map')
+if cc.has_link_argument(base_symbol_map)
+  base_ldflags += base_symbol_map
+endif
+
+libgnome_desktop_base_sources = [
+  'gnome-desktop-thumbnail.c',
+  'gnome-idle-monitor.c',
+  'gnome-languages.c',
+  'gnome-pnp-ids.c',
+  'gnome-systemd.c',
+  'gnome-wall-clock.c',
+  'gnome-xkb-info.c',
+]
+
+libgnome_desktop_base_private_sources = [
+  'gnome-datetime-source.c',
+  'gnome-desktop-thumbnail-script.c',
+  'gnome-gettext-portable.c',
+]
+
+libgnome_desktop_base_headers = [
+  'gnome-desktop-thumbnail.h',
+  'gnome-idle-monitor.h',
+  'gnome-languages.h',
+  'gnome-pnp-ids.h',
+  'gnome-systemd.h',
+  'gnome-wall-clock.h',
+  'gnome-xkb-info.h',
+]
+
+install_headers(libgnome_desktop_base_headers,
+  subdir: 'gnome-desktop-4.0/libgnome-desktop'
+)
+
+base_deps = [
+  gdk_pixbuf_dep,
+  glib_dep,
+  gio_dep,
+  gio_unix_dep,
+  libsystemd_dep,
+  schemas_dep,
+  xkb_config_dep,
+  xkbregistry_dep,
+  iso_codes_dep,
+  udev_dep,
+  seccomp_dep,
+  m_dep,
+  rt_dep,
+]
+
+libgnome_desktop_base = library('gnome-desktop-4',
+  sources: [
+    libgnome_desktop_base_sources,
+    libgnome_desktop_base_private_sources,
+    dbus_idle_built_sources,
+  ],
+  dependencies: base_deps,
+  soversion: 0,
+  version: libversion,
+  c_args: libargs,
+  link_args: base_ldflags,
+  install: true,
+  include_directories: [
+    include_directories('.'),
+    include_directories('..'),
+  ],
+)
+
+libgnome_desktop_base_gir = gnome.generate_gir(libgnome_desktop_base,
+  sources: [libgnome_desktop_base_headers, libgnome_desktop_base_sources],
+  export_packages: 'gnome-desktop-4',
+  namespace: 'GnomeDesktop',
+  nsversion: '4.0',
+  includes: ['GObject-2.0', 'Gio-2.0', 'GDesktopEnums-3.0', 'GdkPixbuf-2.0'],
+  extra_args: ['-DGNOME_DESKTOP_USE_UNSTABLE_API', '--quiet', '--warn-all'],
+  identifier_prefix: 'Gnome',
+  symbol_prefix: 'gnome',
+  install: true,
+)
+
+pkg.generate(
+  libgnome_desktop_base,
+  requires: ['gsettings-desktop-schemas'],
+  version: meson.project_version(),
+  name: 'gnome-desktop-4',
+  filebase: 'gnome-desktop-4',
+  description: 'Utility library for GNOME desktop components',
+  subdirs: 'gnome-desktop-4.0',
+)
+
+libgnome_desktop_base_dep = declare_dependency(
+  sources: [
+    libgnome_desktop_base_gir,
+  ],
+  dependencies: base_deps,
+  link_with: libgnome_desktop_base,
+  include_directories: [
+    include_directories('.'),
+    include_directories('..'),
+  ],
+)
+
+### Legacy ###
+
 introspection_sources = [
   'gnome-desktop-thumbnail.c',
   'gnome-bg.c',
@@ -22,29 +165,16 @@ introspection_sources = [
   'gnome-wall-clock.c',
   'gnome-xkb-info.c',
   'gnome-idle-monitor.c',
-  'gnome-languages.c'
+  'gnome-languages.c',
 ]
 
-dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
-  'xrandr.xml',
-  namespace: 'MetaDBus',
-  interface_prefix: 'org.gnome.Mutter'
-)
-
-dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
-  'idle-monitor.xml',
-  namespace: 'MetaDBus',
-  interface_prefix: 'org.gnome.Mutter',
-  object_manager: true
-)
-
 libgnome_desktop_sources = [
   introspection_sources,
   dbus_xrandr_built_sources,
   dbus_idle_built_sources,
   'gnome-datetime-source.c',
   'gnome-desktop-thumbnail-script.c',
-  'gnome-gettext-portable.c'
+  'gnome-gettext-portable.c',
 ]
 
 libgnome_desktop_headers = [
@@ -59,7 +189,7 @@ libgnome_desktop_headers = [
   'gnome-wall-clock.h',
   'gnome-xkb-info.h',
   'gnome-idle-monitor.h',
-  'gnome-languages.h'
+  'gnome-languages.h',
 ]
 
 install_headers(libgnome_desktop_headers,
@@ -67,7 +197,6 @@ install_headers(libgnome_desktop_headers,
 )
 
 gnome_desktop_deps = [
-  config_h,
   gdk_pixbuf_dep,
   gtk_dep,
   glib_dep,
@@ -82,25 +211,33 @@ gnome_desktop_deps = [
   seccomp_dep
 ]
 
-ldflags = []
-symbol_map = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'symbol.map')
-if cc.has_link_argument(symbol_map)
-  ldflags += symbol_map
+compat_ldflags = []
+compat_symbol_map = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'symbol.map')
+if cc.has_link_argument(compat_symbol_map)
+  compat_ldflags += compat_symbol_map
 endif
 
 libgnome_desktop = library('gnome-desktop-3',
   libgnome_desktop_sources,
   dependencies: [gnome_desktop_deps, m_dep, rt_dep],
-  soversion: soversion,
-  version: libversion,
+  soversion: compat_soversion,
+  version: compat_libversion,
   c_args: libargs,
-  link_args: ldflags,
-  install: true
+  link_args: compat_ldflags,
+  install: true,
+  include_directories: [
+    include_directories('.'),
+    include_directories('..'),
+  ],
 )
 
 libgnome_desktop_dep = declare_dependency(
   dependencies: gnome_desktop_deps,
-  link_with: libgnome_desktop
+  link_with: libgnome_desktop,
+  include_directories: [
+    include_directories('.'),
+    include_directories('..'),
+  ],
 )
 
 gnome.generate_gir(libgnome_desktop,
@@ -115,7 +252,7 @@ gnome.generate_gir(libgnome_desktop,
   install: true
 )
 
-desktop_pc = pkg.generate(
+pkg.generate(
   libraries: libgnome_desktop,
   requires: ['gtk+-3.0', 'gsettings-desktop-schemas'],
   version: meson.project_version(),
@@ -125,6 +262,7 @@ desktop_pc = pkg.generate(
   subdirs: 'gnome-desktop-3.0'
 )
 
+### Tests
 test_programs = [
   'gnome-rr-debug',
   'test-xkb-info',
diff --git a/meson.build b/meson.build
index 8803b6ed..5782c9c4 100644
--- a/meson.build
+++ b/meson.build
@@ -17,9 +17,13 @@ project('gnome-desktop', 'c',
 # to 0. When bumping the second version, set the third one to zero.
 #
 # A lot easier than libtool, right?
-libversion = '19.1.6'
+libversion = '1.0.0'
 soversion = libversion.split('.')[0]
 
+# Compatibility versions for libgnome-desktop-3
+compat_libversion = '19.1.6'
+compat_soversion = compat_libversion.split('.')[0]
+
 gdk_pixbuf_req = '>= 2.36.5'
 gtk_req = '>= 3.3.6'
 glib_req = '>= 2.53.0'
@@ -79,32 +83,6 @@ if not cc.has_function('clock_gettime', dependencies: rt_dep)
   rt_dep = dependency('', required: false)
 endif
 
-conf = configuration_data()
-
-conf.set_quoted('GETTEXT_PACKAGE', '@0@-3.0'.format(meson.project_name()))
-conf.set_quoted('INSTALL_PREFIX', prefix)
-
-conf.set('ENABLE_SECCOMP', seccomp_dep.found())
-conf.set('HAVE_BWRAP', seccomp_dep.found())
-conf.set('_GNU_SOURCE', seccomp_dep.found())
-
-conf.set('HAVE_SYSTEMD', libsystemd_dep.found())
-conf.set('HAVE_UDEV', udev_dep.found())
-conf.set('HAVE_XKBREGISTRY', xkbregistry_dep.found())
-
-conf.set('HAVE_TIMERFD', cc.has_function('timerfd_create'))
-conf.set('HAVE_OPENAT', cc.has_function('openat'))
-conf.set('HAVE_USELOCALE', cc.has_function('uselocale'))
-conf.set('HAVE_XLOCALE', cc.has_header('xlocale.h'))
-
-config_h = declare_dependency(
-  sources: configure_file(
-    configuration: conf,
-    output: 'config.h'
-  ),
-  include_directories: include_directories('.')
-)
-
 version_array = meson.project_version().split('.')
 version_conf = configuration_data()
 


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