rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #!/usr/bin/perl -w
|
| 2 |
|
| 3 | # According to your environment, please reset these three lines.
|
| 4 | $sevenZipPath = "C:\\Progra~1\\7-Zip"; # According to your environment, please reset this lines.
|
| 5 | $convertPath = "C:\\Progra~1\\ImageMagick-6.3.6-Q16"; # According to your environment, please reset this lines.
|
| 6 | die "7zip folder $sevenZipPath did NOT exist\n" if (!-d $sevenZipPath);
|
| 7 | die "convert folder $convertPath did NOT exist\n" if (!-d $convertPath);
|
| 8 |
|
| 9 | $sevenZipFile = "${sevenZipPath}\\7za.exe";
|
| 10 | $convertFile = "${convertPath}\\convert.exe";
|
| 11 | die "7zip file $sevenZipFile did NOT exist\n" if (!-e $sevenZipFile);
|
| 12 | die "convert file $convertFile did NOT exist\n" if (!-e $convertFile);
|
| 13 |
|
| 14 | $MinGWPath = "C:\\MinGW"; # According to your environment, please reset this lines.
|
| 15 | die "MinGW folder $MinGWPath did NOT exist\n" if (!-d $MinGWPath);
|
| 16 |
|
| 17 | #********************************************************************
|
| 18 | # confirm package
|
| 19 | #********************************************************************
|
| 20 | my $local_path = `cd`;
|
| 21 | chomp $local_path;
|
| 22 | my $make_path = $local_path."\\make";
|
| 23 |
|
| 24 | my $package = "";
|
| 25 | system ("dir $make_path\\rel_*.mak /b >rel.tmp");
|
| 26 |
|
| 27 | open(F, "rel.tmp") || die "Can not open tmp file!";
|
| 28 | while(<F>)
|
| 29 | {
|
| 30 | chomp;
|
| 31 | if ($_ =~ /_(OBJ)_/i)
|
| 32 | {
|
| 33 | $package = $1;
|
| 34 | last;
|
| 35 | }
|
| 36 | }
|
| 37 | close(F);
|
| 38 | system ("del /q rel.tmp");
|
| 39 |
|
| 40 | #********************************************************************
|
| 41 | # confirm which tool needed in OBJ package
|
| 42 | #********************************************************************
|
| 43 | if ($package !~ /OBJ/i)
|
| 44 | {
|
| 45 | $MSYSPath = "C:\\MSYS"; # According to your environment, please reset this lines.
|
| 46 | die "MSYS folder $MSYSPath did NOT exist\n" if (!-d $MSYSPath);
|
| 47 | $MSYSPath .= "\\1.0";
|
| 48 | die "MSYS folder $MSYSPath did NOT exist\n" if (!-d $MSYSPath);
|
| 49 |
|
| 50 | @mapDirs = (
|
| 51 | [ "${MinGWPath}\\bin", qw(pcore\tools\MinGW\bin) ],
|
| 52 | [ "${MinGWPath}\\lib", qw(pcore\tools\MinGW\lib) ],
|
| 53 | [ "${MinGWPath}\\include", qw(pcore\tools\MinGW\include) ],
|
| 54 | [ "${MSYSPath}\\bin", qw(pcore\tools\MSYS\bin) ],
|
| 55 | [ "${MSYSPath}\\etc", qw(pcore\tools\MSYS\etc) ],
|
| 56 | );
|
| 57 | }
|
| 58 |
|
| 59 | #********************************************************************
|
| 60 | # copy MinGW, MSYS directories
|
| 61 | #********************************************************************
|
| 62 | for $i (0 .. $#mapDirs)
|
| 63 | {
|
| 64 | die "Folder $mapDirs[$i][0] did NOT exist\n" if (!-d $mapDirs[$i][0]);
|
| 65 | print("Copy folder $mapDirs[$i][0] to $mapDirs[$i][1]\n");
|
| 66 | system("mkdir $mapDirs[$i][1]") if (!-d $mapDirs[$i][1]);
|
| 67 | system("xcopy /Y /Q /S $mapDirs[$i][0] $mapDirs[$i][1]");
|
| 68 | }
|
| 69 |
|
| 70 | #********************************************************************
|
| 71 | # copy make.exe, 7za.exe, convert.exe
|
| 72 | #********************************************************************
|
| 73 | $MinGWMake = "${MinGWPath}\\bin\\mingw32-make.exe";
|
| 74 | die "MinGW file $MinGWMake did NOT exist\n" if (!-e $MinGWMake);
|
| 75 | @mapFiles = (
|
| 76 | [ $MinGWMake, qw(pcore\tools make.exe) ],
|
| 77 | [ $sevenZipFile, qw(lcmmi\Customer\ResGenerator 7za.exe) ],
|
| 78 | [ $convertFile, qw(lcmmi\Customer\ResGenerator convert.exe) ],
|
| 79 | [ $sevenZipFile, qw(plutommi\Customer\ResGenerator 7za.exe) ],
|
| 80 | [ $convertFile, qw(plutommi\Customer\ResGenerator convert.exe) ],
|
| 81 | );
|
| 82 |
|
| 83 | for $i (0 .. $#mapFiles) {
|
| 84 | if (-d $mapFiles[$i][1]) {
|
| 85 | print("Copy file $mapFiles[$i][0] to $mapFiles[$i][1]\\$mapFiles[$i][2]\n");
|
| 86 | system("copy /Y $mapFiles[$i][0] $mapFiles[$i][1]\\$mapFiles[$i][2] > nul 2>&1");
|
| 87 | }
|
| 88 | }
|
| 89 |
|
| 90 | system ("pcore\\tools\\chk_env.exe");
|
| 91 |
|
| 92 | exit 0;
|
| 93 |
|