From: Takashi Sakamoto Date: Wed, 16 Mar 2022 00:03:48 +0000 (+0900) Subject: meson: code refactoring to remove useless assignments for include headers X-Git-Tag: v0.3.0~257 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=ac7c096dae151910286e26bfc46cd362123c8404;p=alsa-gobject.git meson: code refactoring to remove useless assignments for include headers In meson build, gnome.mkenums_simple() and gnome.genmarshal() voluntarily install headers, therefore it's useless to install them explicitly by install_headers(). This commit removes useless assignments for include headers. I note that gnome.generate_gir() fails to parse codes when enums are prior to headers and sources. This commit also reorder entries for safe. Signed-off-by: Takashi Sakamoto --- diff --git a/src/ctl/meson.build b/src/ctl/meson.build index e9eff30..f98d7dd 100644 --- a/src/ctl/meson.build +++ b/src/ctl/meson.build @@ -54,6 +54,7 @@ inc_dir = join_paths(meson.project_name(), path) # Generate enumerations for GObject fashion. if has_enumerations enum_header = '@0@-enum-types.h'.format(name) + headers += enum_header enums = gnome.mkenums_simple('@0@-enums'.format(name), sources: enum_header, symbol_prefix: name, @@ -62,20 +63,21 @@ if has_enumerations install_dir: join_paths(get_option('includedir'), inc_dir), header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)), ) - sources += enums - headers += enum_header +else + enums = [] endif # Generate marshallers for GObject signals. if has_marshaller - signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), + marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), prefix: '@0@_sigs_marshal'.format(name), sources: '@0@-sigs-marshal.list'.format(name), stdinc: true, install_header: true, install_dir: join_paths(get_option('includedir'), inc_dir), ) - sources += signal_marshallers +else + marshallers = [] endif # Constrain public APIs by linker option. @@ -84,7 +86,7 @@ mapfile_path = join_paths(meson.current_source_dir(), mapfile_name) linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path) library = library(name, - sources: sources + headers + privates, + sources: sources + headers + privates + enums + marshallers, version: meson.project_version(), soversion: meson.project_version().split('.')[0], install: true, @@ -107,7 +109,7 @@ pkg.generate(library, # Generate metadata for gobject introspection. gnome.generate_gir(library, - sources: sources + headers, + sources: enums + marshallers + headers + sources, nsversion: '0.0', namespace: namespace, symbol_prefix: '@0@_'.format(name), diff --git a/src/hwdep/meson.build b/src/hwdep/meson.build index b3a766a..cdbbbb8 100644 --- a/src/hwdep/meson.build +++ b/src/hwdep/meson.build @@ -46,6 +46,7 @@ inc_dir = join_paths(meson.project_name(), path) # Generate enumerations for GObject fashion. if has_enumerations enum_header = '@0@-enum-types.h'.format(name) + headers += enum_header enums = gnome.mkenums_simple('@0@-enums'.format(name), sources: enum_header, symbol_prefix: name, @@ -54,20 +55,21 @@ if has_enumerations install_dir: join_paths(get_option('includedir'), inc_dir), header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)), ) - sources += enums - headers += enum_header +else + enums = [] endif # Generate marshallers for GObject signals. if has_marshaller - signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), + marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), prefix: '@0@_sigs_marshal'.format(name), sources: '@0@-sigs-marshal.list'.format(name), stdinc: true, install_header: true, install_dir: join_paths(get_option('includedir'), inc_dir), ) - sources += signal_marshallers +else + marshallers = [] endif # Constrain public APIs by linker option. @@ -76,7 +78,7 @@ mapfile_path = join_paths(meson.current_source_dir(), mapfile_name) linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path) library = library(name, - sources: sources + headers + privates, + sources: sources + headers + privates + enums + marshallers, version: meson.project_version(), soversion: meson.project_version().split('.')[0], install: true, @@ -99,7 +101,7 @@ pkg.generate(library, # Generate metadata for gobject introspection. gnome.generate_gir(library, - sources: sources + headers, + sources: enums + headers + sources, nsversion: '0.0', namespace: namespace, symbol_prefix: '@0@_'.format(name), diff --git a/src/rawmidi/meson.build b/src/rawmidi/meson.build index 049bffd..30809a4 100644 --- a/src/rawmidi/meson.build +++ b/src/rawmidi/meson.build @@ -52,6 +52,7 @@ inc_dir = join_paths(meson.project_name(), path) # Generate enumerations for GObject fashion. if has_enumerations enum_header = '@0@-enum-types.h'.format(name) + headers += enum_header enums = gnome.mkenums_simple('@0@-enums'.format(name), sources: enum_header, symbol_prefix: name, @@ -60,20 +61,21 @@ if has_enumerations install_dir: join_paths(get_option('includedir'), inc_dir), header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)), ) - sources += enums - headers += enum_header +else + enums = [] endif # Generate marshallers for GObject signals. if has_marshaller - signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), + marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), prefix: '@0@_sigs_marshal'.format(name), sources: '@0@-sigs-marshal.list'.format(name), stdinc: true, install_header: true, install_dir: join_paths(get_option('includedir'), inc_dir), ) - sources += signal_marshallers +else + marshallers = [] endif # Constrain public APIs by linker option. @@ -82,7 +84,7 @@ mapfile_path = join_paths(meson.current_source_dir(), mapfile_name) linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path) library = library(name, - sources: sources + headers + privates, + sources: sources + headers + privates + enums + marshallers, version: meson.project_version(), soversion: meson.project_version().split('.')[0], install: true, @@ -105,7 +107,7 @@ pkg.generate(library, # Generate metadata for gobject introspection. gnome.generate_gir(library, - sources: sources + headers, + sources: enums + headers + sources, nsversion: '0.0', namespace: namespace, symbol_prefix: '@0@_'.format(name), diff --git a/src/seq/meson.build b/src/seq/meson.build index 5c150f9..52095b8 100644 --- a/src/seq/meson.build +++ b/src/seq/meson.build @@ -85,6 +85,7 @@ inc_dir = join_paths(meson.project_name(), path) # Generate enumerations for GObject fashion. if has_enumerations enum_header = '@0@-enum-types.h'.format(name) + headers += enum_header enums = gnome.mkenums_simple('@0@-enums'.format(name), sources: enum_header, symbol_prefix: name, @@ -93,20 +94,22 @@ if has_enumerations install_dir: join_paths(get_option('includedir'), inc_dir), header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)), ) - sources += enums - headers += enum_header +else + enum + s = [] endif # Generate marshallers for GObject signals. if has_marshaller - signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), + marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), prefix: '@0@_sigs_marshal'.format(name), sources: '@0@-sigs-marshal.list'.format(name), stdinc: true, install_header: true, install_dir: join_paths(get_option('includedir'), inc_dir), ) - sources += signal_marshallers +else + marshallers = [] endif # Constrain public APIs by linker option. @@ -115,7 +118,7 @@ mapfile_path = join_paths(meson.current_source_dir(), mapfile_name) linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path) library = library(name, - sources: sources + headers + privates, + sources: sources + headers + privates + enums + marshallers, version: meson.project_version(), soversion: meson.project_version().split('.')[0], install: true, @@ -138,7 +141,7 @@ pkg.generate(library, # Generate metadata for gobject introspection. gnome.generate_gir(library, - sources: sources + headers, + sources: enums + headers + sources, nsversion: '0.0', namespace: namespace, symbol_prefix: '@0@_'.format(name), diff --git a/src/timer/meson.build b/src/timer/meson.build index cc21e90..04fc2db 100644 --- a/src/timer/meson.build +++ b/src/timer/meson.build @@ -66,6 +66,7 @@ inc_dir = join_paths(meson.project_name(), path) # Generate enumerations for GObject fashion. if has_enumerations enum_header = '@0@-enum-types.h'.format(name) + headers += enum_header enums = gnome.mkenums_simple('@0@-enums'.format(name), sources: enum_header, symbol_prefix: name, @@ -74,20 +75,21 @@ if has_enumerations install_dir: join_paths(get_option('includedir'), inc_dir), header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)), ) - sources += enums - headers += enum_header +else + enums = [] endif # Generate marshallers for GObject signals. if has_marshaller - signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), + marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name), prefix: '@0@_sigs_marshal'.format(name), sources: '@0@-sigs-marshal.list'.format(name), stdinc: true, install_header: true, install_dir: join_paths(get_option('includedir'), inc_dir), ) - sources += signal_marshallers +else + marshallers = [] endif # Constrain public APIs by linker option. @@ -96,7 +98,7 @@ mapfile_path = join_paths(meson.current_source_dir(), mapfile_name) linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path) library = library(name, - sources: sources + headers + privates, + sources: sources + headers + privates + enums + marshallers, version: meson.project_version(), soversion: meson.project_version().split('.')[0], install: true, @@ -119,7 +121,7 @@ pkg.generate(library, # Generate metadata for gobject introspection. alsatimer_gir = gnome.generate_gir(library, - sources: sources + headers, + sources: enums + headers + sources, nsversion: '0.0', namespace: namespace, symbol_prefix: '@0@_'.format(name),