fnsince.pl 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/usr/bin/perl -w
  2. use warnings;
  3. use strict;
  4. use File::Basename;
  5. chdir(dirname(__FILE__));
  6. chdir('..');
  7. my @unsorted_releases = ();
  8. open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n";
  9. while (<PIPEFH>) {
  10. chomp;
  11. if (/\Arelease\-(.*?)\Z/) {
  12. push @unsorted_releases, $1;
  13. }
  14. }
  15. close(PIPEFH);
  16. #print("\n\nUNSORTED\n");
  17. #foreach (@unsorted_releases) {
  18. # print "$_\n";
  19. #}
  20. my @releases = sort {
  21. my @asplit = split /\./, $a;
  22. my @bsplit = split /\./, $b;
  23. my $rc;
  24. for (my $i = 0; $i < scalar(@asplit); $i++) {
  25. return 1 if (scalar(@bsplit) <= $i); # a is "2.0.1" and b is "2.0", or whatever.
  26. my $aseg = $asplit[$i];
  27. my $bseg = $bsplit[$i];
  28. $rc = int($aseg) <=> int($bseg);
  29. return $rc if ($rc != 0); # found the difference.
  30. }
  31. return 0; # still here? They matched completely?!
  32. } @unsorted_releases;
  33. #print("\n\nSORTED\n");
  34. #foreach (@releases) {
  35. # print "$_\n";
  36. #}
  37. push @releases, 'HEAD';
  38. my %funcs = ();
  39. foreach my $release (@releases) {
  40. #print("Checking $release...\n");
  41. next if ($release eq '2.0.0') || ($release eq '2.0.1'); # no dynapi before 2.0.2
  42. my $assigned_release = ($release eq '2.0.2') ? '2.0.0' : $release; # assume everything in 2.0.2--first with dynapi--was there since 2.0.0. We'll fix it up later.
  43. my $tag = ($release eq 'HEAD') ? $release : "release-$release";
  44. my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h";
  45. open(PIPEFH, '-|', "git show '$blobname'") or die "Failed to read git blob '$blobname': $!\n";
  46. while (<PIPEFH>) {
  47. chomp;
  48. if (/\A\#define\s+(SDL_.*?)\s+SDL_.*?_REAL\Z/) {
  49. my $fn = $1;
  50. $funcs{$fn} = $assigned_release if not defined $funcs{$fn};
  51. }
  52. }
  53. close(PIPEFH);
  54. }
  55. # Fixup the handful of functions that were added in 2.0.1 and 2.0.2 that we
  56. # didn't have dynapi revision data about...
  57. $funcs{'SDL_GetSystemRAM'} = '2.0.1';
  58. $funcs{'SDL_GetBasePath'} = '2.0.1';
  59. $funcs{'SDL_GetPrefPath'} = '2.0.1';
  60. $funcs{'SDL_UpdateYUVTexture'} = '2.0.1';
  61. $funcs{'SDL_GL_GetDrawableSize'} = '2.0.1';
  62. $funcs{'SDL_GetAssertionHandler'} = '2.0.2';
  63. $funcs{'SDL_GetDefaultAssertionHandler'} = '2.0.2';
  64. $funcs{'SDL_AtomicAdd'} = '2.0.2';
  65. $funcs{'SDL_AtomicGet'} = '2.0.2';
  66. $funcs{'SDL_AtomicGetPtr'} = '2.0.2';
  67. $funcs{'SDL_AtomicSet'} = '2.0.2';
  68. $funcs{'SDL_AtomicSetPtr'} = '2.0.2';
  69. $funcs{'SDL_HasAVX'} = '2.0.2';
  70. $funcs{'SDL_GameControllerAddMappingsFromRW'} = '2.0.2';
  71. $funcs{'SDL_acos'} = '2.0.2';
  72. $funcs{'SDL_asin'} = '2.0.2';
  73. $funcs{'SDL_vsscanf'} = '2.0.2';
  74. $funcs{'SDL_DetachThread'} = '2.0.2';
  75. $funcs{'SDL_GL_ResetAttributes'} = '2.0.2';
  76. foreach my $release (@releases) {
  77. foreach my $fn (sort keys %funcs) {
  78. print("$fn: $funcs{$fn}\n") if $funcs{$fn} eq $release;
  79. }
  80. }