blob: 3881f92e1ea42203221f7d5a6a04a35d46e0d6c2 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#!/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.
6die "7zip folder $sevenZipPath did NOT exist\n" if (!-d $sevenZipPath);
7die "convert folder $convertPath did NOT exist\n" if (!-d $convertPath);
8
9$sevenZipFile = "${sevenZipPath}\\7za.exe";
10$convertFile = "${convertPath}\\convert.exe";
11die "7zip file $sevenZipFile did NOT exist\n" if (!-e $sevenZipFile);
12die "convert file $convertFile did NOT exist\n" if (!-e $convertFile);
13
14$MinGWPath = "C:\\MinGW"; # According to your environment, please reset this lines.
15die "MinGW folder $MinGWPath did NOT exist\n" if (!-d $MinGWPath);
16
17#********************************************************************
18# confirm package
19#********************************************************************
20my $local_path = `cd`;
21chomp $local_path;
22my $make_path = $local_path."\\make";
23
24my $package = "";
25system ("dir $make_path\\rel_*.mak /b >rel.tmp");
26
27open(F, "rel.tmp") || die "Can not open tmp file!";
28while(<F>)
29{
30 chomp;
31 if ($_ =~ /_(OBJ)_/i)
32 {
33 $package = $1;
34 last;
35 }
36}
37close(F);
38system ("del /q rel.tmp");
39
40#********************************************************************
41# confirm which tool needed in OBJ package
42#********************************************************************
43if ($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#********************************************************************
62for $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";
74die "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
83for $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
90system ("pcore\\tools\\chk_env.exe");
91
92exit 0;
93