diff options
-rw-r--r-- | desktop-directories/meson.build | 40 | ||||
-rw-r--r-- | layout/meson.build | 10 | ||||
-rw-r--r-- | libmenu/meson.build | 72 | ||||
-rw-r--r-- | meson.build | 185 | ||||
-rw-r--r-- | meson_options.txt | 25 | ||||
-rw-r--r-- | po/meson.build | 2 | ||||
-rw-r--r-- | util/meson.build | 10 |
7 files changed, 344 insertions, 0 deletions
diff --git a/desktop-directories/meson.build b/desktop-directories/meson.build new file mode 100644 index 0000000..1121fe1 --- /dev/null +++ b/desktop-directories/meson.build @@ -0,0 +1,40 @@ +desktop_files = [ +# Should be moved to mate-control-center: + 'mate-hardware.directory', + 'mate-internet-and-network.directory', + 'mate-look-and-feel.directory', + 'mate-personal.directory', + 'mate-system.directory', + + 'mate-audio-video.directory', + 'mate-development.directory', + 'mate-education.directory', + 'mate-game.directory', + 'mate-graphics.directory', + 'mate-network.directory', + 'mate-office.directory', + 'mate-settings.directory', + 'mate-settings-system.directory', + 'mate-system-tools.directory', + 'mate-utility.directory', + 'mate-utility-accessibility.directory', + 'mate-other.directory', + 'mate-menu-applications.directory', + 'mate-menu-system.directory', + 'mate-collection.directory', +] + +foreach f : desktop_files + desktop_file = i18n.merge_file( + input: '@[email protected]'.format(f), + output: f, + type: 'desktop', + po_dir: join_paths(srcdir, 'po'), + install: true, + install_dir: join_paths( + datadir, + 'mate', + 'desktop-directories', + ) + ) +endforeach diff --git a/layout/meson.build b/layout/meson.build new file mode 100644 index 0000000..87778b3 --- /dev/null +++ b/layout/meson.build @@ -0,0 +1,10 @@ +menu_files = [ + 'mate-applications.menu', + 'mate-settings.menu', + 'mate-preferences-categories.menu', +] + +install_data(menu_files, + install_dir : get_option('sysconfdir') / 'xdg/menus' +) + diff --git a/libmenu/meson.build b/libmenu/meson.build new file mode 100644 index 0000000..5fbc93e --- /dev/null +++ b/libmenu/meson.build @@ -0,0 +1,72 @@ +source_h = [ + 'matemenu-tree.h', +] + +install_headers(source_h, subdir : 'mate-menus') + +sources = [ + 'desktop-entries.h', + 'entry-directories.h', + 'menu-layout.h', + 'menu-monitor.h', + 'menu-util.h', + 'desktop-entries.c', + 'entry-directories.c', + 'matemenu-tree.c', + 'menu-layout.c', + 'menu-monitor.c', + 'menu-util.c', +] + +gnome = import('gnome') +pkg = import('pkgconfig') + +libmate_menu = shared_library('mate-menu', + sources, + dependencies: [gio_unix_dep], + soversion: soversion, + version: libversion, + include_directories: top_srcdir, + install : true, + install_dir : get_option('libdir') + ) + +libmate_menu_deps = declare_dependency(sources: source_h, + include_directories: [top_srcdir, include_directories('.')], + dependencies: [gio_unix_dep], + link_with: libmate_menu) + +pkg.generate( + name: 'mate-menu', + version: meson.project_version(), + description: 'Desktop Menu Specification Implementation', + requires_private: 'gio-unix-2.0', + filebase: 'libmate-menu', + libraries: '-lmate-menu', + subdirs: 'mate-menus', + ) + +if get_option('introspection') + libmate_menu_gir = gnome.generate_gir(libmate_menu, + sources: [source_h, sources], + nsversion : api_version, + namespace : 'MateMenu', + symbol_prefix : 'matemenu', + export_packages: 'libmatemenu', + identifier_prefix : 'MateMenu', + link_with: libmate_menu, + includes : ['Gio-2.0'], + install : true, + install_dir_gir: girdir, + install_dir_typelib: typelibdir, + extra_args: [ '--c-include=mate-menus/matemenu-tree.h' ], + ) + if get_option('vapi') + mate_menu_vapi = gnome.generate_vapi('libmate-menu', + sources: libmate_menu_gir.get(0), + packages: 'gio-unix-2.0', + install: true, + install_dir: vapidir, + ) + endif +endif diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..0cbef89 --- /dev/null +++ b/meson.build @@ -0,0 +1,185 @@ +project( + 'mate-menus', 'c', + version: '1.27.0', + meson_version: '>=0.56.0', + license: 'GPL2', + default_options : [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'], +) + +package_name = meson.project_name() +package_version = meson.project_version() + +# Versionning +version_arr = package_version.split('.') +mate_menu_version_major = version_arr[0].to_int() +mate_menu_version_minor = version_arr[1].to_int() +mate_menu_version_micro = version_arr[2].to_int() + +api_version = '2.0' +soversion = 2 + +if mate_menu_version_minor.is_odd() + mate_menu_interface_age = 0 +else + mate_menu_interface_age = mate_menu_version_micro +endif + +# maintaining compatibility with the previous libtool versioning +# current = minor * 100 + micro - interface +# revision = interface +current = mate_menu_version_minor * 100 + mate_menu_version_micro - mate_menu_interface_age +revision = mate_menu_interface_age +libversion = '@0@.@1@.@2@'.format(soversion, current, revision) +# FIXME: next version should use above code for libversion +libversion = '2.4.9' + +package_string = '@0@ @[email protected]'.format(package_name, package_version) + +config_h = configuration_data() +config_h.set_quoted('PACKAGE', package_name, description: 'Name of package') +config_h.set_quoted('PACKAGE_NAME', package_name, description: 'Define to the full name of this package.') +config_h.set_quoted('PACKAGE_STRING', package_string, description: 'Define to the full name and version of this package.') +config_h.set_quoted('PACKAGE_VERSION', package_version, description: 'Define to the version of this package.') +config_h.set_quoted('PACKAGE_URL', 'https://mate-desktop.org', description: 'Define to the home page for this package.') +config_h.set_quoted('GETTEXT_PACKAGE', package_name, description: 'Gettext package') +config_h.set_quoted('VERSION', package_version, description: 'Name of package') + +if get_option('collection') + config_h.set10('WITH_COLLECTION', true) +endif + +# Compiler & Project arguments +add_project_arguments([ + '-DHAVE_CONFIG_H', + '-DMATEMENU_I_KNOW_THIS_IS_UNSTABLE', + '-I' + meson.project_build_root(), + ], language: 'c') + +# get suported warning flags +test_args = [ + '-fstack-protector-strong', + '-Waggregate-return', + '-Warray-bounds', + '-Wcast-align', + '-Wchar-subscripts', + '-Wclobbered', + '-Wdeclaration-after-statement', + '-Wempty-body', + '-Wformat=2', + '-Wformat-nonliteral', + '-Wformat-security', + '-Werror=format-security', + '-Werror=format=2', + '-Wformat-signedness', + '-Wignored-qualifiers', + '-Wimplicit-function-declaration', + '-Winit-self', + '-Winline', + '-Wmissing-declarations', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wmissing-noreturn', + '-Wmissing-parameter-type', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wno-discarded-qualifiers', + '-Wno-missing-field-initializers', + '-Wno-strict-aliasing', + '-Wno-suggest-attribute=format', + '-Wno-unused-parameter', + '-Wold-style-definition', + '-Woverride-init', + '-Wpacked', + '-Wpointer-arith', + '-Wredundant-decls', + '-Wreturn-type', + '-Wshadow', + '-Wsign-compare', + '-Wstrict-aliasing', + '-Wstrict-prototypes', + '-Wswitch-default', + '-Wtype-limits', + '-Wundef', + '-Wuninitialized', + '-Wunused-but-set-variable', + '-Wwrite-strings', + '-ansi', + ] + +cc = meson.get_compiler('c') + +foreach arg: test_args + if cc.has_multi_arguments(arg) + add_project_arguments(arg, language : 'c') + endif +endforeach + +gnome = import('gnome') +i18n = import('i18n') + +# Paths +top_srcdir = include_directories('.') +srcdir = meson.current_source_dir() +builddir = meson.current_build_dir() + +prefix = get_option('prefix') +buildtype = get_option('buildtype') +bindir = join_paths(prefix, get_option('bindir')) +libdir = join_paths(prefix, get_option('libdir')) +datadir = join_paths(prefix, get_option('datadir')) +pkgdatadir = join_paths(datadir, package_name) + +# Setup various paths that subdirectory meson.build files need +package_subdir = get_option('package_subdir') +girdir = join_paths(get_option('datadir'), package_subdir, 'gir-1.0') +typelibdir = join_paths(get_option('libdir'), package_subdir, 'girepository-1.0') +libdir = join_paths(get_option('libdir'), package_subdir) +if package_subdir != '' + vapidir = join_paths(get_option('datadir'), package_subdir, 'vapi') +else + vapidir = join_paths(get_option('datadir'), 'vala', 'vapi') +endif + +if get_option('debug') + add_project_arguments('-DG_ENABLE_DEBUG', language : 'c') +else + add_project_arguments('-DG_DISABLE_ASSERT', + '-DG_DISABLE_CHECKS', + language : 'c') +endif + +# Dependencies +gio_req = '>= 2.50.0' +gio_unix_dep = dependency('gio-unix-2.0', version: gio_req) + +configure_file( + output: 'config.h', + configuration: config_h +) + +subdir('libmenu') +subdir('layout') +subdir('desktop-directories') +subdir('util') +subdir('po') + +summary({ + 'prefix': prefix, + 'exec_prefix': get_option('bindir'), + 'libdir': libdir, + 'bindir': bindir, + 'sbindir': get_option('sbindir'), + 'sysconfdir': get_option('sysconfdir'), + 'localstatedir': get_option('localstatedir'), + 'datadir': datadir, + }, + section: 'Directories' +) + +summary({ + 'Turn on debugging': get_option('debug'), + 'Collection menu entry': get_option('collection'), + 'Build introspection support': get_option('introspection'), + }, + section: 'Configuration' +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..779efc2 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,25 @@ +option('introspection', + type: 'boolean', + value : true, + description: 'Build with GObject Introspection support') + +option('vapi', + type: 'boolean', + value: false, + description: 'Build to generation vala vapi file') + +option('collection', + type : 'boolean', + value : true, + description : 'Build with collection menu entry support') + +option('tests', + type : 'boolean', + value : false, + description : 'Enable test programs (default: no)') + +# For subproject usage +option('package_subdir', + type: 'string', + description: 'Private sub-directory used when built as a subproject' +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..7e2b19f --- /dev/null +++ b/po/meson.build @@ -0,0 +1,2 @@ +i18n = import('i18n') +i18n.gettext(meson.project_name(), preset: 'glib',) diff --git a/util/meson.build b/util/meson.build new file mode 100644 index 0000000..d735321 --- /dev/null +++ b/util/meson.build @@ -0,0 +1,10 @@ +t = executable('mate-menu-spec-test', + sources : 'test-menu-spec.c', + dependencies : libmate_menu_deps, + install : false, +) + +test('mate-menu-testing', t) + +install_data('mate-menus-ls.py', install_dir : pkgdatadir / 'examples') + |