summaryrefslogtreecommitdiff
path: root/Build-tools/mysql-copyright
diff options
context:
space:
mode:
authorjoerg@mysql.com <>2004-09-20 17:58:11 +0200
committerjoerg@mysql.com <>2004-09-20 17:58:11 +0200
commit87a8e833aeeb8c8bdf89de493279e4a68bb92709 (patch)
tree7dbde3924bea8dd438ff2d6ddeeebcb30dcef4a9 /Build-tools/mysql-copyright
parent5cf8e9d76913bc26c867287fcd45be8a15d6434d (diff)
downloadmariadb-git-87a8e833aeeb8c8bdf89de493279e4a68bb92709.tar.gz
When coyright text is changed, autotools must be run after all
other actions, as otherwise timestamps of "config.h.in" will cause re-run on compilation machine (fatal version problem!).
Diffstat (limited to 'Build-tools/mysql-copyright')
-rwxr-xr-xBuild-tools/mysql-copyright140
1 files changed, 112 insertions, 28 deletions
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index a1869304ba7..251a6c78d23 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -i
+#!/usr/bin/perl -wi
# Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory
-$VER="1.3";
+$VER="1.4";
use Cwd;
use File::Basename;
@@ -79,7 +79,7 @@ sub main
$newdistname .= $suffix if $win_flag;
}
# find out the extract path (should be same as distname!)
- chomp($destdir = `tar ztf ../$distfile | head -1`);
+ chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove slash from the end
$destdir= substr($destdir, 0, -1);
@@ -104,37 +104,25 @@ sub main
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
- # remove readline subdir and update configure accordingly
- system("rm -rf $destdir/cmd-line-utils/readline");
- if ($win_flag) {
- chdir("$destdir") or (print "$! Unable to change directory to $destdir!\n" && exit(0));
- } else {
- chdir("$destdir");
- unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
- open(CONFIGURE,"<configure.in") or die "$! Unable to open configure.in to read from!\n";
- local $/;
- undef $/;
- my $configure = <CONFIGURE>;
- close(CONFIGURE);
- $configure =~ s|cmd\-line\-utils/readline/Makefile dnl\n?||g;
- open(CONFIGURE,">configure.in") or die "$! Unable to open configure.in to write to!\n";
- print CONFIGURE $configure;
- close(CONFIGURE);
- `aclocal && autoheader && aclocal && automake && autoconf`;
- if (! -f "configure") {
- print "\"./configure\" was not produced, exiting!\n";
- exit(0);
- }
- if (-d "autom4te.cache") {
- print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
- system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
- }
+ # remove subdirectories 'bdb', 'cmd-line-utils/readline'
+ # (latter does not apply to 4.0, but is in different place there!)
+ my @extra_fat= ('bdb', 'cmd-line-utils/readline');
+
+ foreach my $fat (@extra_fat)
+ {
+ &trim_the_fat($fat);
}
# fix file copyrights
&fix_usage_copyright();
&add_copyright();
+ # fix LICENSE tag in include/mysql_version.h
+ &fix_mysql_version();
+
+ # apply "autotools" - must be last to ensure proper timestamps
+ &run_autotools();
+
# rename the directory with new distribution name
chdir("$WD/$dir");
print "renaming $destdir $newdistname\n" if $opt_verbose;
@@ -161,6 +149,101 @@ sub main
}
####
+#### This function will s/GPL/Commercial/ in include/mysql_version.h for the
+#### LICENSE tag.
+####
+sub fix_mysql_version
+{
+ my $cwd= getcwd();
+ chdir("$destdir");
+ my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
+
+ open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
+ undef $/;
+ my $mysql_version= <MYSQL_VERSION>;
+ close(MYSQL_VERSION);
+
+ $mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
+
+ open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
+ print MYSQL_VERSION $mysql_version;
+ close(MYSQL_VERSION);
+ chdir("$cwd");
+}
+
+####
+#### This function will remove unwanted parts of a src tree for the mysqlcom
+#### distributions.
+####
+sub trim_the_fat
+{
+ my $the_fat= shift;
+ my $cwd= getcwd();
+
+ chdir("$destdir");
+ if ( -d "${the_fat}" )
+ {
+ system("rm -rf ${the_fat}");
+ if (!$win_flag)
+ {
+ open(CONFIG_IN,"<configure.in") or die "Unable to open configure.in for read: $!\n";
+ undef $/;
+ my $config_in= <CONFIG_IN>;
+ close(CONFIG_IN);
+
+ #
+ # If $the_fat Makefile line closes the parenthesis, then
+ # replace that line with just the closing parenthesis.
+ #
+ if ($config_in=~ m|${the_fat}/Makefile\)\n?|)
+ {
+ $config_in=~ s|${the_fat}/Makefile(\)\n?)|$1|;
+ }
+ #
+ # Else just delete the line
+ #
+ else
+ {
+ $config_in=~ s|${the_fat}/Makefile dnl\n?||;
+ }
+
+ open(CONFIG_IN,">configure.in") or die "Unable to open configure.in for write: $!\n";
+ print CONFIG_IN $config_in;
+ close(CONFIG_IN);
+ }
+ }
+ chdir("$cwd");
+}
+
+
+####
+#### This function will run the autotools on the reduced source tree.
+####
+sub run_autotools
+{
+ my $cwd= getcwd();
+
+ if (!$win_flag)
+ {
+ chdir("$destdir");
+ unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
+
+ # File "configure.in" has already been modified by "trim_the_fat()"
+
+ `aclocal && autoheader && aclocal && automake && autoconf`;
+ die "'./configure' was not produced!" unless (-f "configure");
+
+ if (-d "autom4te.cache") {
+ print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
+ system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
+ }
+
+ chdir("$cwd");
+ }
+}
+
+
+####
#### mysqld and MySQL client programs have a usage printed with --help.
#### This usage includes a copyright, which needs to be modified
####
@@ -191,6 +274,7 @@ sub add_copyright
foreach my $file (@files)
{
next if ! -f $file;
+ next if -B $file;
print "processing file $file in cwd $cwd\n" if $opt_verbose;
`$WD/Build-tools/mysql-copyright-2 "$file"`;
}