Skip to content

Commit

Permalink
gnome: genmarshal: If the source includes the header, depend on it
Browse files Browse the repository at this point in the history
Otherwise we're racing between the header generation and the source
generation.
  • Loading branch information
dcbaker authored and eli-schwartz committed Jan 28, 2022
1 parent 11f9638 commit 457fb53
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions mesonbuild/modules/gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,21 +1924,6 @@ def genmarshal(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'GenMarsh
capture = True

header_file = output + '.h'
c_cmd = cmd + ['--body', '@INPUT@']
if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.53.4'):
# Silence any warnings about missing prototypes
c_cmd += ['--include-header', header_file]
body = build.CustomTarget(
output + '_c',
state.subdir,
state.subproject,
c_cmd,
sources,
[f'{output}.c'],
capture=capture,
depend_files=kwargs['depend_files'],
)

h_cmd = cmd + ['--header', '@INPUT@']
if new_genmarshal:
h_cmd += ['--pragma-once']
Expand All @@ -1955,6 +1940,24 @@ def genmarshal(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'GenMarsh
depend_files=kwargs['depend_files'],
)

c_cmd = cmd + ['--body', '@INPUT@']
extra_deps: T.List[build.CustomTarget] = []
if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.53.4'):
# Silence any warnings about missing prototypes
c_cmd += ['--include-header', header_file]
extra_deps.append(header)
body = build.CustomTarget(
output + '_c',
state.subdir,
state.subproject,
c_cmd,
sources,
[f'{output}.c'],
capture=capture,
depend_files=kwargs['depend_files'],
extra_depends=extra_deps,
)

rv = [body, header]
return ModuleReturnValue(rv, rv)

Expand Down

0 comments on commit 457fb53

Please sign in to comment.