|
1 |
| -# |
2 |
| -# Use this script to copy the Mono file used by IL2CPP. |
3 |
| -# perl external\buildscripts\copy_il2cpp_sources.pl --monoroot=<Mono root clone> --sourcesroot=<Unity root clone>\External\MonoBleedingEdge\builds\source |
4 |
| -# |
5 |
| - |
6 |
| -use File::Basename; |
7 |
| -use File::Copy; |
8 |
| -use File::Path; |
9 |
| -use Getopt::Long; |
10 |
| - |
11 |
| -my $monoroot =""; |
12 |
| -my $sourcesroot = ""; |
13 |
| - |
14 |
| -GetOptions( |
15 |
| - 'monoroot=s'=>\$monoroot, |
16 |
| - 'sourcesroot=s'=>\$sourcesroot, |
17 |
| -) or die ("illegal cmdline options"); |
18 |
| - |
19 |
| -my $sourcesFile = "$monoroot/external/buildscripts/sources.txt"; |
20 |
| -open(SOURCE_FILE, $sourcesFile) or die "failed opening $sourcesFile\n"; |
21 |
| -my @listOfSourceFilesLines = <SOURCE_FILE>; |
22 |
| -close(SOURCE_FILE); |
23 |
| -chomp(@listOfSourceFilesLines); |
24 |
| - |
25 |
| -my $isPrivateFile = 0; |
26 |
| -foreach my $sourcesLine(@listOfSourceFilesLines) |
27 |
| -{ |
28 |
| - if($sourcesLine =~ /#.*/) |
29 |
| - { |
30 |
| - next; |
31 |
| - } |
32 |
| - elsif($sourcesLine =~ /SOURCES:/ or $sourcesLine =~ /HEADERS:/ or $sourcesLine =~ /METADATA:/) |
33 |
| - { |
34 |
| - $isPrivateFile = 0; |
35 |
| - next; |
36 |
| - } |
37 |
| - elsif($sourcesLine =~ /PRIVATE:/) |
38 |
| - { |
39 |
| - $isPrivateFile = 1; |
40 |
| - next; |
41 |
| - } |
42 |
| - |
43 |
| - $fileToCopy = "$monoroot/$sourcesLine"; |
44 |
| - $destFile = "$sourcesroot/$sourcesLine"; |
45 |
| - if($isPrivateFile) |
46 |
| - { |
47 |
| - $destFile =~ s/(.*)\/(.*\.c)/$1\/private\/$2/g; |
48 |
| - } |
49 |
| - |
50 |
| - $destDir = dirname("$destFile"); |
51 |
| - if (!-d $destDir) |
52 |
| - { |
53 |
| - mkpath($destDir) or die "failed making directory $destDir\n"; |
54 |
| - } |
55 |
| - |
56 |
| - if (-e $fileToCopy) |
57 |
| - { |
58 |
| - copy($fileToCopy, $destFile) or die "failed to copy $fileToCopy to $destFile\n"; |
59 |
| - } |
60 |
| -} |
| 1 | +# |
| 2 | +# Use this script to copy the Mono file used by IL2CPP. |
| 3 | +# perl external\buildscripts\copy_il2cpp_sources.pl --monoroot=<Mono root clone> --sourcesroot=<Unity root clone>\External\MonoBleedingEdge\builds\source |
| 4 | +# |
| 5 | + |
| 6 | +use File::Basename; |
| 7 | +use File::Copy; |
| 8 | +use File::Path; |
| 9 | +use Getopt::Long; |
| 10 | + |
| 11 | +my $monoroot =""; |
| 12 | +my $sourcesroot = ""; |
| 13 | + |
| 14 | +GetOptions( |
| 15 | + 'monoroot=s'=>\$monoroot, |
| 16 | + 'sourcesroot=s'=>\$sourcesroot, |
| 17 | +) or die ("illegal cmdline options"); |
| 18 | + |
| 19 | +my $sourcesFile = "$monoroot/external/buildscripts/sources.txt"; |
| 20 | +open(SOURCE_FILE, $sourcesFile) or die "failed opening $sourcesFile\n"; |
| 21 | +my @listOfSourceFilesLines = <SOURCE_FILE>; |
| 22 | +close(SOURCE_FILE); |
| 23 | +chomp(@listOfSourceFilesLines); |
| 24 | + |
| 25 | +my $isPrivateFile = 0; |
| 26 | +foreach my $sourcesLine(@listOfSourceFilesLines) |
| 27 | +{ |
| 28 | + if($sourcesLine =~ /#.*/) |
| 29 | + { |
| 30 | + next; |
| 31 | + } |
| 32 | + elsif($sourcesLine =~ /SOURCES:/ or $sourcesLine =~ /HEADERS:/ or $sourcesLine =~ /METADATA:/) |
| 33 | + { |
| 34 | + $isPrivateFile = 0; |
| 35 | + next; |
| 36 | + } |
| 37 | + elsif($sourcesLine =~ /PRIVATE:/) |
| 38 | + { |
| 39 | + $isPrivateFile = 1; |
| 40 | + next; |
| 41 | + } |
| 42 | + |
| 43 | + $fileToCopy = "$monoroot/$sourcesLine"; |
| 44 | + $destFile = "$sourcesroot/$sourcesLine"; |
| 45 | + if($isPrivateFile) |
| 46 | + { |
| 47 | + $destFile =~ s/(.*)\/(.*\.c)/$1\/private\/$2/g; |
| 48 | + } |
| 49 | + |
| 50 | + $destDir = dirname("$destFile"); |
| 51 | + if (!-d $destDir) |
| 52 | + { |
| 53 | + mkpath($destDir) or die "failed making directory $destDir\n"; |
| 54 | + } |
| 55 | + |
| 56 | + if (-e $fileToCopy) |
| 57 | + { |
| 58 | + copy($fileToCopy, $destFile) or die "failed to copy $fileToCopy to $destFile\n"; |
| 59 | + } |
| 60 | + else |
| 61 | + { |
| 62 | + die "Source file to copy does not exist: $fileToCopy\n"; |
| 63 | + } |
| 64 | +} |
0 commit comments