Skip to content

Commit

Permalink
dynapi: order for a reproducible build
Browse files Browse the repository at this point in the history
The objfiles of different builds show various differences in
the calls to SDL_DYNAPI_entry elements. This is generated
dynamically by gendynapi.pl which uses an unordered opendir/readdir
pair. To make the build reproducible and thereby e.g. debugging
easier change this to be used in an ordered fashion.

Fixes #11565.
  • Loading branch information
cpaelzer authored and slouken committed Dec 2, 2024
1 parent 0251b14 commit 5418740
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dynapi/gendynapi.pl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@
open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
open(SDL2_EXPORTS, '>>', $sdl2_exports) or die("Can't open $sdl2_exports: $!\n");

# Ordered for reproducible builds
opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
while (my $d = readdir(HEADERS)) {
my @entries = readdir(HEADERS);
closedir(HEADERS);
# Sort the entries
@entries = sort @entries;
foreach my $d (@entries) {
next if not $d =~ /\.h\Z/;
my $header = "include/$d";
open(HEADER, '<', $header) or die("Can't open $header: $!\n");
Expand Down Expand Up @@ -143,8 +148,6 @@
close(HEADER);
}

closedir(HEADERS);

close(SDL_DYNAPI_PROCS_H);
close(SDL_DYNAPI_OVERRIDES_H);
close(SDL2_EXPORTS);
Expand Down

0 comments on commit 5418740

Please sign in to comment.