You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.8 KiB

  1. #!perl
  2. # Enable in-place editing
  3. BEGIN
  4. {
  5. $^I = '.bak';
  6. }
  7. use strict;
  8. use feature 'unicode_strings';
  9. # parse line from include/log4cplus/version.h
  10. open (my $fh, "<", "include/log4cplus/version.h")
  11. or die $!;
  12. my ($major, $minor, $point, $version);
  13. while (my $line = <$fh>)
  14. {
  15. if ($line =~ m/\s* # \s* define \s+ LOG4CPLUS_VERSION \s+
  16. LOG4CPLUS_MAKE_VERSION \s* \(
  17. \s* (\d+) \s* , \s* (\d+) \s* , \s* (\d+) \s* \)/x)
  18. {
  19. ($major, $minor, $point) = ($1, $2, $3);
  20. $version = "$major.$minor.$point";
  21. print "version: ", $version, "\n";
  22. last;
  23. }
  24. }
  25. close $fh;
  26. # parse SO version from configure.ac
  27. open (my $fh2, "<", "configure.ac")
  28. or die $!;
  29. my ($so_current, $so_revision, $so_age, $so_current_adjusted);
  30. while (my $line = <$fh2>)
  31. {
  32. if ($line =~ m/\s* LT_VERSION= \s*
  33. (\d+) \s* : \s* (\d+) \s* : \s* (\d+) \s*/x)
  34. {
  35. ($so_current, $so_revision, $so_age) = ($1, $2, $3);
  36. print +("SO version: ", $so_current, ".", $so_revision, ".", $so_age,
  37. "\n");
  38. $so_current_adjusted = $so_current - $so_age;
  39. print +("MingGW/Cygwin version: ", $major, "-", $minor, "-",
  40. $so_current_adjusted, "\n");
  41. last;
  42. }
  43. }
  44. close $fh2;
  45. # edit configure.ac
  46. {
  47. local $^I = ".bak";
  48. local @ARGV = ("configure.ac");
  49. while (my $line = <>)
  50. {
  51. $line =~ s/(.*AC_INIT\(.*\[)(\d+(?:\.\d+(?:\.\d+)?)?)(\].*)/$1$version$3/x;
  52. $line =~ s/(.*LT_RELEASE=)(.*)/$1$major.$minor/x;
  53. print $line;
  54. }
  55. local @ARGV = ("docs/doxygen.config");
  56. while (my $line = <>)
  57. {
  58. $line =~ s/(\s* PROJECT_NUMBER \s* = \s*)(.*)/$1$version/x;
  59. $line =~ s/(\s* OUTPUT_DIRECTORY \s* = \s*)(.*)/$1log4cplus-$version\/docs/x;
  60. print $line;
  61. }
  62. local @ARGV = ("docs/webpage_doxygen.config");
  63. while (my $line = <>)
  64. {
  65. $line =~ s/(\s* PROJECT_NUMBER \s* = \s*)(.*)/$1$version/x;
  66. $line =~ s/(\s* OUTPUT_DIRECTORY \s* = \s*)(.*)/$1webpage_docs-$version/x;
  67. print $line;
  68. }
  69. local @ARGV = ("log4cplus.spec", "mingw-log4cplus.spec");
  70. while (my $line = <>)
  71. {
  72. $line =~ s/(Version: \s*)(.*)/$1$version/x;
  73. if ($line =~ /Source\d*:/x)
  74. {
  75. $line =~ s/(\d+\.\d+\.\d+)/$version/gx;
  76. }
  77. print $line;
  78. }
  79. local @ARGV = ("cygport/log4cplus.cygport");
  80. while (my $line = <>)
  81. {
  82. $line =~ s/(\s* VERSION \s* = \s*)(\d+\.\d+\.\d+)(-.+)?/$1$version$3/x
  83. || $line =~ s/\d+ ([._\-]) \d+ ([._\-]) \d+
  84. /$major$1$minor$2$so_current_adjusted/gx;
  85. print $line;
  86. }
  87. local @ARGV = ("CMakeLists.txt");
  88. while (my $line = <>)
  89. {
  90. $line =~ s/(set\s*\(log4cplus_soversion\s*)\d+(\))/$1$so_current$2/x;
  91. print $line;
  92. }
  93. }