yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | #!/usr/bin/perl
|
| 2 | #
|
| 3 | # Copyright Statement:
|
| 4 | # --------------------
|
| 5 | # This software is protected by Copyright and the information contained
|
| 6 | # herein is confidential. The software may not be copied and the information
|
| 7 | # contained herein may not be used or disclosed except with the written
|
| 8 | # permission of MediaTek Inc. (C) 2005
|
| 9 | #
|
| 10 | # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
|
| 11 | # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
|
| 12 | # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
|
| 13 | # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
|
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
|
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
|
| 16 | # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
|
| 17 | # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
|
| 18 | # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
|
| 19 | # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
|
| 20 | # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
|
| 21 | # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
|
| 22 | #
|
| 23 | # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
|
| 24 | # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
|
| 25 | # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
|
| 26 | # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
|
| 27 | # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
|
| 28 | #
|
| 29 | # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
|
| 30 | # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
|
| 31 | # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
|
| 32 | # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
|
| 33 | # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
|
| 34 | #
|
| 35 | #
|
| 36 | #******************************************************************************
|
| 37 | # Module Use
|
| 38 | #******************************************************************************
|
| 39 | use File::Copy;
|
| 40 | use File::Path;
|
| 41 | use File::Spec;
|
| 42 | my $dev_nul = File::Spec->devnull();
|
| 43 | #******************************************************************************
|
| 44 | # Subroutine: Usage
|
| 45 | #******************************************************************************
|
| 46 | sub usage {
|
| 47 | print "perl custominfo.pl <Makefile>\n";
|
| 48 | exit 1;
|
| 49 | }
|
| 50 |
|
| 51 | #******************************************************************************
|
| 52 | # Check input arguments
|
| 53 | #******************************************************************************
|
| 54 | &Usage if ($#ARGV == -1);
|
| 55 | $thefile = $ARGV[0];
|
| 56 |
|
| 57 | die "$thefile does NOT exist\n" if (!-e $thefile);
|
| 58 | if ($thefile =~ /make\/(\w+)_(\w+)\((\w+)\)\.mak/i) {
|
| 59 | $custom = uc($1);
|
| 60 | $project = lc($2);
|
| 61 | print " custom = $custom\n project = $project \n flavor = $3 \n";
|
| 62 | }
|
| 63 |
|
| 64 | ($custom eq "") && &Usage;
|
| 65 | ($project eq "") && &Usage;
|
| 66 |
|
| 67 | open (FILE_HANDLE, "<$thefile") or die "Cannot open $thefile\n";
|
| 68 | while (<FILE_HANDLE>) {
|
| 69 | if ((/^([^\#]*)\#?.*/) && ($1 =~ /^(\w+)\s*=\s*(.*\S)\s*$/)){
|
| 70 | $keyname = lc($1);
|
| 71 | $${keyname} = uc($2);
|
| 72 | }
|
| 73 | }
|
| 74 | close FILE_HANDLE;
|
| 75 |
|
| 76 | if (($mmi_version eq "NEPTUNE_MMI") || ($mmi_version eq "NEPTUNE_COLOR_MMI")) {
|
| 77 | $mmidir = "lcmmi";
|
| 78 | } else {
|
| 79 | $mmidir = "plutommi";
|
| 80 | }
|
| 81 |
|
| 82 | #******************************************************************************
|
| 83 | # Section for
|
| 84 | # >>> Copy default files to project folder
|
| 85 | #******************************************************************************
|
| 86 | if (defined $touch_panel_shortcut_support) {
|
| 87 | if ($touch_panel_shortcut_support eq "TRUE") {
|
| 88 | copy("pcore/custom/common/touch_panel_shortcut_custom.c.tmp", "pcore/custom/app/$board_ver/touch_panel_shortcut_custom.c");
|
| 89 | copy("pcore/custom/common/touch_panel_shortcut_custom.h.tmp", "pcore/custom/app/$board_ver/touch_panel_shortcut_custom.h");
|
| 90 | }
|
| 91 | }
|
| 92 |
|
| 93 | if (-d "${mmidir}/Customer/Images/decoder/RGB565") {
|
| 94 | copy("copy ${mmidir}/Customer/Images/decoder/RGB565/*.*", "${mmidir}/Customer/Images");
|
| 95 | }
|
| 96 |
|
| 97 | #******************************************************************************
|
| 98 | # Procress for JAVA
|
| 99 | #******************************************************************************
|
| 100 | my @thatdirs;
|
| 101 |
|
| 102 | if (($project ne "basic") && ($project ne "l1s") && defined($j2me_support)) {
|
| 103 | if ($j2me_support ne "NONE") {
|
| 104 | if ($j2me_support eq "JBLENDIA") {
|
| 105 | push(@thatdirs, "j2me/JBLENDIA");
|
| 106 | $j2me_boardBB = $board_ver;
|
| 107 | } elsif ($j2me_support eq "JBLENDIA_MVM") {
|
| 108 | push(@thatdirs, "j2me/jblendia_mvm");
|
| 109 | $j2me_boardBB = $board_ver;
|
| 110 | } elsif ($j2me_support eq "JBED") {
|
| 111 | push(@thatdirs, "j2me/JBED");
|
| 112 | $j2me_boardBB = $board_ver;
|
| 113 | } elsif ($j2me_support eq "NEMO") {
|
| 114 | push(@thatdirs, "j2me/NEMO");
|
| 115 | $j2me_boardBB = $board_ver;
|
| 116 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 117 | $j2me_boardBB = "${board_ver}\($original_flavor\)";
|
| 118 | }
|
| 119 | }elsif($j2me_support eq "IJET"){
|
| 120 | push(@thatdirs, "j2me/IJET");
|
| 121 | $j2me_boardBB = $board_ver;
|
| 122 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 123 | $j2me_boardBB = "${board_ver}\($original_flavor\)";
|
| 124 | }
|
| 125 | } elsif ($j2me_support eq "MTK_DUMMY_MVM") {
|
| 126 | push(@thatdirs, "j2me/DUMMY");
|
| 127 | $j2me_boardBB = $board_ver;
|
| 128 | } else {
|
| 129 | push(@thatdirs, "j2me/DUMMY");
|
| 130 | $j2me_boardBB = $board_ver;
|
| 131 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 132 | $j2me_boardBB = "${board_ver}\($original_flavor\)";
|
| 133 | }
|
| 134 | }
|
| 135 | my $j2meFolder = $j2me_support;
|
| 136 | if($j2me_support eq "MTK_DUMMY_MVM"){
|
| 137 | $j2meFolder = "DUMMY";
|
| 138 | }
|
| 139 | if (!-e "pcore/custom/j2me/$j2meFolder/$j2me_boardBB/j2me_custom_option.h") {
|
| 140 | if (-e "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/_j2me_custom_option.h") {
|
| 141 | copy("pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/_j2me_custom_option.h", "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_option.h");
|
| 142 | }
|
| 143 | } else {
|
| 144 | if (-e "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_option.h") {
|
| 145 | unlink("pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_option.h");
|
| 146 | }
|
| 147 | }
|
| 148 |
|
| 149 | if (!-e "pcore/custom/j2me/$j2meFolder/$j2me_boardBB/j2me_custom_param.h") {
|
| 150 | if (-e "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/_j2me_custom_param.h") {
|
| 151 | copy("pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/_j2me_custom_param.h", "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_param.h");
|
| 152 | }
|
| 153 | } else {
|
| 154 | if (-e "pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_param.h") {
|
| 155 | unlink("pcore/custom/j2me/$j2meFolder/_DEFAULT_BB/j2me_custom_param.h");
|
| 156 | }
|
| 157 | }
|
| 158 | }
|
| 159 | }
|
| 160 |
|
| 161 | foreach $t (@thatdirs) {
|
| 162 | $thatdir = "pcore/custom/$t";
|
| 163 | $defaultBB = "$thatdir/_DEFAULT_BB";
|
| 164 | $boardBB = "${thatdir}/${board_ver}";
|
| 165 | if ($j2me_support eq "IJET") {
|
| 166 | $j2me_boardBB = $boardBB;
|
| 167 | if (($original_flavor !~ /\bNONE\b/i) && (!-e "${thatdir}/${board_ver}\($original_flavor\)")) {
|
| 168 | print "${thatdir}/${board_ver}\($original_flavor\) does not exist. Please execute romizing first.\n";
|
| 169 | exit(1);
|
| 170 | }
|
| 171 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 172 | if (-e "${thatdir}/${board_ver}\($original_flavor\)") {
|
| 173 | $j2me_boardBB = "${thatdir}/${board_ver}\($original_flavor\)";
|
| 174 | }
|
| 175 | }
|
| 176 | }elsif ($j2me_support eq "NEMO") {
|
| 177 | $j2me_boardBB = $boardBB;
|
| 178 | if (($original_flavor !~ /\bNONE\b/i) && (!-e "${thatdir}/${board_ver}\($original_flavor\)")) {
|
| 179 | print "${thatdir}/${board_ver}\($original_flavor\) does not exist. Please execute romizing first.\n";
|
| 180 | exit(1);
|
| 181 | }
|
| 182 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 183 | if (-e "${thatdir}/${board_ver}\($original_flavor\)") {
|
| 184 | $j2me_boardBB = "${thatdir}/${board_ver}\($original_flavor\)";
|
| 185 | }
|
| 186 | }
|
| 187 | }
|
| 188 | if ($j2me_support eq "JBLENDIA" || $j2me_support eq "JBLENDIA_MVM") {
|
| 189 |
|
| 190 | $gameGenDir = "$defaultBB/jblend_preinstall";
|
| 191 | $gameExe = "DirRomizer.exe";
|
| 192 | $gamePapay = "PapayaPik.exe";
|
| 193 | $gameConfig = "PapayaPik.cfg";
|
| 194 | $gameGenFile = "${gameGenDir}/$gameExe";
|
| 195 | $certRomizer = "certRomizer.exe";
|
| 196 | $certRomizerFile = "${gameGenDir}/$certRomizer";
|
| 197 | $certRomizerString = $certRomizerFile;
|
| 198 | if ((-d $defaultBB) && (-d $gameGenDir) && (-e $gameGenFile)) {
|
| 199 | chdir($gameGenDir);
|
| 200 | $gamecfg = "../../$board_ver/$gameConfig";
|
| 201 | $gamecfgdir = "../../$board_ver";
|
| 202 | if (-e $gamecfg) {
|
| 203 | unlink("$gamecfg");
|
| 204 | }
|
| 205 | if (!-e $gamecfg) {
|
| 206 | mkpath("$gamecfgdir") if (!-e $gamecfgdir);
|
| 207 | copy($gameConfig, $gamecfg);
|
| 208 | open (GAME_CFG_H, ">>$gamecfg") or die "Cannot open $gamecfg\n";
|
| 209 | $jarcnt = 1;
|
| 210 | if (((-d "../../$board_ver") && (<../../$board_ver/*.jar>)) ||
|
| 211 | (!((($mmi_version eq "PLUTO_MMI")||($mmi_version eq "COSMOS_MMI")||($mmi_version eq "NEPTUNE_MMI")||($mmi_version eq "NEPTUNE_COLOR_MMI")) &&
|
| 212 | ($empty_resource eq "FALSE")))) {
|
| 213 | while ($jarname = <../../${board_ver}/*.jar>) {
|
| 214 | $jadname = $jarname;
|
| 215 | $jadname =~ s/\.jar/\.jad/;
|
| 216 | ($jadname = "") if (!-e $jadname);
|
| 217 | print GAME_CFG_H "MIDletSuite-$jarcnt: $jadname , $jarname\n";
|
| 218 | $jarcnt++;
|
| 219 | }
|
| 220 | } else {
|
| 221 | while ($jarname = <../*.jar>) {
|
| 222 | $jadname = $jarname;
|
| 223 | $jadname =~ s/\.jar/\.jad/;
|
| 224 | ($jadname = "") if (!-e $jadname);
|
| 225 | print GAME_CFG_H "MIDletSuite-$jarcnt: $jadname , $jarname\n";
|
| 226 | $jarcnt++;
|
| 227 | }
|
| 228 | }
|
| 229 | close GAME_CFG_H;
|
| 230 | }
|
| 231 | unlink("./rom/*");
|
| 232 | print("$gamePapay -config $gamecfg\n");
|
| 233 | system("$gamePapay -config $gamecfg");
|
| 234 | print("$gameExe rom\n");
|
| 235 | system("$gameExe rom > $dev_nul");
|
| 236 | move("kjava_sys_data_content.c", "../../$board_ver");
|
| 237 | move("kjava_sys_data_content.h", "../../$board_ver");
|
| 238 | # back to mcu folder
|
| 239 | chdir("../../../../..");
|
| 240 | }
|
| 241 | # For certRomizer.exe
|
| 242 | if (-e "$boardBB/kjava_sys_ext_cert.c") {
|
| 243 | unlink("$boardBB/kjava_sys_ext_cert.c");
|
| 244 | }
|
| 245 | if (-e "$defaultBB/kjava_sys_ext_cert.c") {
|
| 246 | unlink("$defaultBB/kjava_sys_ext_cert.c");
|
| 247 | }
|
| 248 |
|
| 249 | if (-e $certRomizerFile) {
|
| 250 | if (<$boardBB/cert/*.cer>) {
|
| 251 | while (<$boardBB/cert/*.cer>) {
|
| 252 | $certRomizerString = $certRomizerString." ".$_;
|
| 253 | }
|
| 254 | system("$certRomizerString > $boardBB/kjava_sys_ext_cert.c");
|
| 255 | } elsif (<$gameGenDir/cert/*.cer>){
|
| 256 | while (<$gameGenDir/cert/*.cer>) {
|
| 257 | $certRomizerString = $certRomizerString." ".$_;
|
| 258 | }
|
| 259 | system("$certRomizerString > $defaultBB/kjava_sys_ext_cert.c");
|
| 260 | }
|
| 261 | }
|
| 262 | } else {
|
| 263 | $gameGenDir = "$defaultBB/builtin_game_generator";
|
| 264 | $gameExe = "DefaultGameGen.exe";
|
| 265 | $gameGenFile = "${gameGenDir}/$gameExe";
|
| 266 | $ori_board_ver = $board_ver;
|
| 267 | if ($original_flavor !~ /\bNONE\b/i) {
|
| 268 | $board_ver = "${board_ver}\($original_flavor\)";
|
| 269 | }
|
| 270 | if ((-d $defaultBB) && (-d $gameGenDir) && (-e $gameGenFile)) {
|
| 271 | chdir($gameGenDir);
|
| 272 | if (((-d "../../$board_ver") && ((<../../$board_ver/*.jar>) || (<../../$board_ver/*.jad>))) ||
|
| 273 | (!((($mmi_version eq "PLUTO_MMI")||($mmi_version eq "COSMOS_MMI")||($mmi_version eq "NEPTUNE_MMI")||($mmi_version eq "NEPTUNE_COLOR_MMI")) ))) {
|
| 274 | if ((-d "../../$board_ver") && ((-e "../../$board_ver/_main.ks") && (-e "../../$board_ver/_policy.txt") && (-e "../../$board_ver/_tck.ks") )) {
|
| 275 | print("$gameExe -certfolder -setpath ./setting -inputSystem ../../$board_ver -inputMidlet ../../$board_ver -output ../../$board_ver -create -logpath ../../$board_ver\n");
|
| 276 | system("$gameExe -certfolder -setpath ./setting -inputSystem ../../$board_ver -inputMidlet ../../$board_ver -output ../../$board_ver -create -logpath ../../$board_ver");
|
| 277 | } else {
|
| 278 | print("$gameExe -certfolder -setpath ./setting -inputSystem .. -inputMidlet ../../$board_ver -output ../../$board_ver -create -logpath ../../$board_ver\n");
|
| 279 | system("$gameExe -certfolder -setpath ./setting -inputSystem .. -inputMidlet ../../$board_ver -output ../../$board_ver -create -logpath ../../$board_ver");
|
| 280 |
|
| 281 | }
|
| 282 | } else {
|
| 283 | if ((-d "../../$board_ver") && ((-e "../../$board_ver/_main.ks") && (-e "../../$board_ver/_policy.txt") && (-e "../../$board_ver/_tck.ks") )) {
|
| 284 | print("$gameExe -certfolder -setpath ./setting -inputSystem ../../$board_ver -inputMidlet .. -output ../../$board_ver -create -logpath ..\n");
|
| 285 | system("$gameExe -certfolder -setpath ./setting -inputSystem ../../$board_ver -inputMidlet .. -output ../../$board_ver -create -logpath ..");
|
| 286 |
|
| 287 | } else {
|
| 288 | print("$gameExe -certfolder -setpath ./setting -inputSystem .. -inputMidlet .. -output .. -create -logpath ..\n");
|
| 289 | system("$gameExe -certfolder -setpath ./setting -inputSystem .. -inputMidlet .. -output .. -create -logpath ..");
|
| 290 |
|
| 291 | }
|
| 292 | }
|
| 293 | # back to mcu folder
|
| 294 | chdir("../../../../..");
|
| 295 | } else {
|
| 296 | print("Skip to generate JAVA game due to no $gameGenFile\n");
|
| 297 | }
|
| 298 | $board_ver = $ori_board_ver;
|
| 299 | }
|
| 300 |
|
| 301 | }
|
| 302 |
|
| 303 | exit(0);
|
| 304 |
|