Commit 2c4e5ad1 authored by Alexandre Julliard's avatar Alexandre Julliard

make_unicode: Cache files under their full path name to avoid conflicts.

parent 28ece74f
...@@ -24,12 +24,14 @@ use strict; ...@@ -24,12 +24,14 @@ use strict;
# base URLs for www.unicode.org files # base URLs for www.unicode.org files
my $MAPPINGS = "http://www.unicode.org/Public/MAPPINGS"; my $MAPPINGS = "http://www.unicode.org/Public/MAPPINGS";
my $UNIDATA = "http://www.unicode.org/Public/6.0.0/ucd"; my $UNIDATA = "http://www.unicode.org/Public/6.0.0/ucd";
my $REPORTS = "http://www.unicode.org/reports";
my $RFCS = "http://www.rfc-editor.org/rfc";
# Sort keys file # Sort keys file
my $SORTKEYS = "http://www.unicode.org/reports/tr10/allkeys.txt"; my $SORTKEYS = "tr10/allkeys.txt";
# RFC3454 (stringprep data) # RFC3454 (stringprep data)
my $STRINGPREP = "http://www.rfc-editor.org/rfc/rfc3454.txt"; my $STRINGPREP = "rfc3454.txt";
# Defaults mapping # Defaults mapping
my $DEFAULTS = "tools/unicode-defaults"; my $DEFAULTS = "tools/unicode-defaults";
...@@ -319,16 +321,16 @@ my %joining_forms = ...@@ -319,16 +321,16 @@ my %joining_forms =
################################################################ ################################################################
# fetch a unicode.org file and open it # fetch a unicode.org file and open it
sub open_data_file($) sub open_data_file($$)
{ {
my $url = shift; my ($base, $name) = @_;
(my $name = $url) =~ s/^.*\///; (my $dir = "data/$name") =~ s/\/[^\/]+$//;
local *FILE; local *FILE;
unless (-f "data/$name") unless (-f "data/$name")
{ {
print "Fetching $url...\n"; print "Fetching $base/$name...\n";
mkdir "data"; system "mkdir", "-p", $dir;
!system "wget", "-q", "-O", "data/$name", $url or die "cannot fetch $url"; !system "wget", "-q", "-O", "data/$name", "$base/$name" or die "cannot fetch $base/$name";
} }
open FILE, "<data/$name" or die "cannot open data/$name"; open FILE, "<data/$name" or die "cannot open data/$name";
return *FILE; return *FILE;
...@@ -370,7 +372,7 @@ sub READ_DEFAULTS($) ...@@ -370,7 +372,7 @@ sub READ_DEFAULTS($)
# now build mappings from the decomposition field of the Unicode database # now build mappings from the decomposition field of the Unicode database
my $UNICODE_DATA = open_data_file "$UNIDATA/UnicodeData.txt"; my $UNICODE_DATA = open_data_file( $UNIDATA, "UnicodeData.txt" );
while (<$UNICODE_DATA>) while (<$UNICODE_DATA>)
{ {
# Decode the fields ... # Decode the fields ...
...@@ -497,7 +499,7 @@ sub READ_DEFAULTS($) ...@@ -497,7 +499,7 @@ sub READ_DEFAULTS($)
sub READ_FILE($) sub READ_FILE($)
{ {
my $name = shift; my $name = shift;
my $INPUT = open_data_file $name; my $INPUT = open_data_file( $MAPPINGS, $name );
while (<$INPUT>) while (<$INPUT>)
{ {
...@@ -623,7 +625,7 @@ sub READ_JIS0208_FILE($) ...@@ -623,7 +625,7 @@ sub READ_JIS0208_FILE($)
$cp2uni[0xa1c0] = 0xff3c; $cp2uni[0xa1c0] = 0xff3c;
$uni2cp[0xff3c] = 0xa1c0; $uni2cp[0xff3c] = 0xa1c0;
my $INPUT = open_data_file $name; my $INPUT = open_data_file( $MAPPINGS, $name );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -650,7 +652,7 @@ sub READ_SORTKEYS_FILE() ...@@ -650,7 +652,7 @@ sub READ_SORTKEYS_FILE()
my @sortkeys = (); my @sortkeys = ();
for (my $i = 0; $i < 65536; $i++) { $sortkeys[$i] = [ -1, 0, 0, 0, 0 ] }; for (my $i = 0; $i < 65536; $i++) { $sortkeys[$i] = [ -1, 0, 0, 0, 0 ] };
my $INPUT = open_data_file $SORTKEYS; my $INPUT = open_data_file( $REPORTS, $SORTKEYS );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -757,7 +759,7 @@ sub DUMP_SORTKEYS($@) ...@@ -757,7 +759,7 @@ sub DUMP_SORTKEYS($@)
open OUTPUT,">$filename.new" or die "Cannot create $filename"; open OUTPUT,">$filename.new" or die "Cannot create $filename";
printf "Building $filename\n"; printf "Building $filename\n";
printf OUTPUT "/* Unicode collation element table */\n"; printf OUTPUT "/* Unicode collation element table */\n";
printf OUTPUT "/* generated from %s */\n", $SORTKEYS; printf OUTPUT "/* generated from %s */\n", "$REPORTS/$SORTKEYS";
printf OUTPUT "/* DO NOT EDIT!! */\n\n"; printf OUTPUT "/* DO NOT EDIT!! */\n\n";
printf OUTPUT "const unsigned int collation_table[%d] =\n{\n", $ranges*256; printf OUTPUT "const unsigned int collation_table[%d] =\n{\n", $ranges*256;
...@@ -1062,7 +1064,7 @@ sub dump_indic($) ...@@ -1062,7 +1064,7 @@ sub dump_indic($)
my $filename = shift; my $filename = shift;
my @indic_table = ($indic_types{'Other'}) x 65536;; my @indic_table = ($indic_types{'Other'}) x 65536;;
my $INPUT = open_data_file "$UNIDATA/IndicSyllabicCategory.txt"; my $INPUT = open_data_file( $UNIDATA, "IndicSyllabicCategory.txt" );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -1095,7 +1097,7 @@ sub dump_indic($) ...@@ -1095,7 +1097,7 @@ sub dump_indic($)
} }
close $INPUT; close $INPUT;
$INPUT = open_data_file "$UNIDATA/IndicMatraCategory.txt"; $INPUT = open_data_file( $UNIDATA, "IndicMatraCategory.txt" );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -1144,7 +1146,7 @@ sub dump_linebreak($) ...@@ -1144,7 +1146,7 @@ sub dump_linebreak($)
my @break_table = ($break_types{'XX'}) x 65536;; my @break_table = ($break_types{'XX'}) x 65536;;
my $next_group = 0; my $next_group = 0;
my $INPUT = open_data_file "$UNIDATA/LineBreak.txt"; my $INPUT = open_data_file( $UNIDATA, "LineBreak.txt" );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -1192,7 +1194,7 @@ sub dump_mirroring($) ...@@ -1192,7 +1194,7 @@ sub dump_mirroring($)
my $filename = shift; my $filename = shift;
my @mirror_table = (); my @mirror_table = ();
my $INPUT = open_data_file "$UNIDATA/BidiMirroring.txt"; my $INPUT = open_data_file( $UNIDATA, "BidiMirroring.txt" );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -1229,7 +1231,7 @@ sub dump_shaping($) ...@@ -1229,7 +1231,7 @@ sub dump_shaping($)
$groups{"No_Joining_Group"} = $next_group++; $groups{"No_Joining_Group"} = $next_group++;
my $INPUT = open_data_file "$UNIDATA/ArabicShaping.txt"; my $INPUT = open_data_file( $UNIDATA, "ArabicShaping.txt" );
while (<$INPUT>) while (<$INPUT>)
{ {
next if /^\#/; # skip comments next if /^\#/; # skip comments
...@@ -1572,7 +1574,7 @@ sub dump_nameprep($) ...@@ -1572,7 +1574,7 @@ sub dump_nameprep($)
my @mapping_table = (); my @mapping_table = ();
my @flags_table = (0) x 65536; my @flags_table = (0) x 65536;
my $INPUT = open_data_file $STRINGPREP; my $INPUT = open_data_file( $RFCS, $STRINGPREP );
while (<$INPUT>) while (<$INPUT>)
{ {
next unless /Start\sTable/; next unless /Start\sTable/;
...@@ -1598,7 +1600,7 @@ sub dump_nameprep($) ...@@ -1598,7 +1600,7 @@ sub dump_nameprep($)
open OUTPUT,">$filename.new" or die "Cannot create $filename"; open OUTPUT,">$filename.new" or die "Cannot create $filename";
print "Building $filename\n"; print "Building $filename\n";
print OUTPUT "/* Nameprep algorithm related data */\n"; print OUTPUT "/* Nameprep algorithm related data */\n";
print OUTPUT "/* generated from $STRINGPREP */\n"; print OUTPUT "/* generated from $RFCS/$STRINGPREP */\n";
print OUTPUT "/* DO NOT EDIT!! */\n\n"; print OUTPUT "/* DO NOT EDIT!! */\n\n";
print OUTPUT "#include \"wine/unicode.h\"\n\n"; print OUTPUT "#include \"wine/unicode.h\"\n\n";
...@@ -1857,7 +1859,7 @@ sub handle_bestfit_file($$$) ...@@ -1857,7 +1859,7 @@ sub handle_bestfit_file($$$)
my ($lb_cur, $lb_end); my ($lb_cur, $lb_end);
my @lb_ranges = (); my @lb_ranges = ();
my $INPUT = open_data_file "$MAPPINGS/$filename" or die "Cannot open $filename"; my $INPUT = open_data_file( $MAPPINGS, $filename ) or die "Cannot open $filename";
while (<$INPUT>) while (<$INPUT>)
{ {
...@@ -1961,14 +1963,14 @@ sub HANDLE_FILE(@) ...@@ -1961,14 +1963,14 @@ sub HANDLE_FILE(@)
@uni2cp = (); @uni2cp = ();
# symbol codepage file is special # symbol codepage file is special
if ($codepage == 20932) { READ_JIS0208_FILE "$MAPPINGS/$filename"; } if ($codepage == 20932) { READ_JIS0208_FILE( $filename ); }
elsif ($codepage == 20127) { fill_20127_codepage(); } elsif ($codepage == 20127) { fill_20127_codepage(); }
elsif ($filename =~ /\/bestfit/) elsif ($filename =~ /\/bestfit/)
{ {
handle_bestfit_file( $filename, $has_glyphs, $comment ); handle_bestfit_file( $filename, $has_glyphs, $comment );
return; return;
} }
else { READ_FILE "$MAPPINGS/$filename"; } else { READ_FILE( $filename ); }
ADD_DEFAULT_MAPPINGS(); ADD_DEFAULT_MAPPINGS();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment