From 64534e9b5bc9b31c9efb55b45c9f1a3364b9d326 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Sun, 28 Nov 2021 16:19:34 +0100 Subject: [PATCH] make_specfiles: Merge -arch options if there are multiple exports with the same name. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- tools/make_specfiles | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/make_specfiles b/tools/make_specfiles index 019f16d3f14..49a032ef14c 100755 --- a/tools/make_specfiles +++ b/tools/make_specfiles @@ -578,7 +578,24 @@ sub read_spec_file($) next unless %descr; my $func = $descr{name}; - next if defined $funcs{$func}; + if (defined $funcs{$func}) + { + my %update = %{$funcs{$func}}; + next if $update{ordinal} ne $descr{ordinal} or $update{callconv} ne $descr{callconv} or $update{args} ne $descr{args}; + + my $arch = $1 if $update{flags} =~ /-arch=(\S+)/; + my $new_arch = $1 if $descr{flags} =~ /-arch=(\S+)/; + next if !defined $arch or !defined $new_arch; + + if (($arch eq "win32" and $new_arch eq "win64") or ($arch eq "win64" and $new_arch eq "win32")) + { + $funcs{$func}{flags} =~ s/-arch=\S+\s+//; + next; + } + + $funcs{$func}{flags} =~ s/-arch=$arch/-arch=$arch,$new_arch/; + next; + } next if $func eq "@"; $funcs{$func} = \%descr; }