MTK安卓编译脚本是以
./mk -t -o=TARGET_BUILD_VARIANT=user v100 new
进行全部编译。下面分析安卓下
在主目录下mk是mediatek/build/mk的软链接
./mk -t -o=TARGET_BUILD_VARIANT=user v100 new
进行全部编译。下面分析安卓下
在主目录下mk是mediatek/build/mk的软链接
在mediatek/build/目录下 mk是makeMtk软链接,下面我们就需要分析makeMtk, 它是perl脚本。
#!/usr/bin/perl
#
# Copyright Statement:
# --------------------
# This software is protected by Copyright and the information contained
# herein is confidential. The software may not be copied and the information
# contained herein may not be used or disclosed except with the written
# permission of MediaTek Inc. (C) 2010
#
# BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
# NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
# SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
#
# BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
# LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
#
# THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
# WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
# LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
# RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
# THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
#
my $DEBUG = 0; # enable/disable script debugging message
#perl debug开关
# Set environment variable for current Android version building
# such as, JDK version, arm-eabi version etc.
# If anymore, you can specify them in ./mbldenv.sh
setBuildEnvVars("./mbldenv.sh");
#导入mbldenv.sh的环境变量
# End
$myCmd = "makeMtk"; #$0
#第一个参数
#space check for build path
$result = `pwd`;
#当前工程的路径
@number = split(" ",$result);
#取以空格分解的字串数组
die "****************************************************************************** \
You are building in a directory whose absolute path contains a space character: \
$result \
Please move your source tree to a path that does not contain any spaces. \
****************************************************************************** \
Directory names containing spaces not supported\n" if($#number != 0);
#判断路径是否有空格,有空格die。
@keywords = ('\[','\]','\(','\)','\{','\}');
foreach $k (@keywords)
{
@number = split($k,$result);
die "****************************************************************************** \
You are building in a directory whose absolute path contains a special character: \
$result \
Please move your source tree to a path that does not contain \"$k\". \
****************************************************************************** \
Directory names containing spaces not supported\n" if($#number != 0);
}
#判断路径中是否包含[ ] () {} 等特殊字符,如果包含就die
$performanceChk = 0;
($performanceChk == 1) && print &CurrTimeStr . " Enter $myCmd\n";
#性能判断,起始时间输出。
@chkDirs = qw(mediatek mediatek/config mediatek/build/tools);
foreach $m (@chkDirs)
{
die "Folder \"$m\" does NOT exist!\nPlease help confirm Mediatek release package.\n" if (!-d $m);
}
#判断mediatek mediatek/config mediatek/build/tools 目录是否存在,不存在就die
@arguments = ();
my $product = "";
$project = "";
$action = "";
@mOpts = ();
$ini = "makeMtk.ini";
$enINI = (-e $ini) ? 1 : 0;
(($#ARGV < 0) || (($#ARGV < 1) && (($enINI == 0) && (lc($ARGV[0]) !~ /^[listp|banyan_addon|banyan_addon_x86]/)))) && &Usage;
$tee = "FALSE";
# mapping table between flag in project name and corresponding product
my $products =
{
"phone" => "phone",
"ph" => "phone",
"tablet" => "tablet",
"tb" => "tablet",
"tv" => "tv",
"default" => "phone"
};
@actions =
qw(
new n bm_new remake r bm_remake clean c listproject listp
drvgen codegen emigen nandgen custgen javaoptgen ptgen run-preprocess remove-preprocessed
check-modem update-modem sign-image encrypt-image sign-modem check-dep
dump-memusage gen-relkey check-appres
rel-cust modem-info bindergen mrproper
);
my @ABSNativeActions =
qw(
customimage bootimage systemimage recoveryimage secroimage cacheimage factoryimage
userdataimage userdataimage-nodeps target-files-package
sdk win_sdk banyan_addon banyan_addon_x86 cts otapackage dist updatepackage
update-api mm snod dump-comp-build-info
);
push(@actions, @ABSNativeActions);
@modules = qw(android kernel dr k preloader pl lk);
@orgARGV = @ARGV;
#以上为初始化变量操作
while ($#ARGV != -1)
{
if ($ARGV[0] =~ /^-(t|te|tee)/)
{
$tee = "TRUE";
}#判断是否需要输出log
elsif ($ARGV[0] =~ /^-h|help/)
{
&Usage;
}#判断是否需要help
elsif ($ARGV[0] =~ /^-(o|op|opt)=(.*)$/)
{
@mOpts = split(",", $2);
}#导入mOpts操作
elsif ($ARGV[0] =~ /^-smart$/)
{
unshift(@mOpts, "MTK_DEPENDENCY_AUTO_CHECK=true");
}#从mOpts中加入依赖检查标识
elsif ($ARGV[0] =~ /^(listp|listproject)/)
{
&p_system("perl mediatek/build/tools/listP.pl");
exit 0;
}#判断是否是列工程名,如果是调用listP.pl脚本显示
elsif ($ARGV[0] =~ /check-env|chk-env/)
{
&chkMustEnv;
exit 0;
}#判断是否是检查环境变量操作
else
{
$project = lc($ARGV[0]);
$project = "generic" if ($project eq "emulator");
if (!-e "mediatek/config/${project}/ProjectConfig.mk")
{
if (-e $ini)
{
open (FILE_HANDLE, "<$ini") or die "cannot open $ini\n";
while (
)
{
if (/^(\S+)\s*=\s*(\S+)/)
{
$keyname = $1;
$${keyname} = $2;
}
}
close FILE_HANDLE;
$project = lc($project);
die "Can NOT find project Makefile "
. "mediatek/config/${project}/ProjectConfig.mk from $ini\n"
if (!-e "mediatek/config/${project}/ProjectConfig.mk");
}
} #检查工程所在的ProjectConfig.mk名字是否存在,如果不存在去makeMtk.ini读取配置,如果还是没有就die
else
{
shift(@ARGV);
}
die "Can NOT recognize project Makefile "
. "mediatek/config/${project}/ProjectConfig.mk from command\n"
if (!-e "mediatek/config/${project}/ProjectConfig.mk");
$action = lc($ARGV[0]);
#保存action
shift(@ARGV);
@arguments = @ARGV;#剩下的参数数组保存到arguments
@ARGV = ();#清空argv变量
}
shift(@ARGV);
}
foreach $prj ("mediatek/config/${project}/ProjectConfig.mk", "mediatek/config/common/ProjectConfig.mk")
{
open (FILE_HANDLE, "<$prj") or die "cannot open $prj\n";
while (
)
{
if (/^(\S+)\s*=\s*(\S+)/)
{
$ENV{$1} = $2;
}
}
close FILE_HANDLE;
}
#把工程的ProjectConfig.mk 和 common ProjectConfig.mk存入到环境中
if (($project ne "banyan_addon") && ($project ne "banyan_addon_x86")) {
die "Lack off the action.\nIt should be one of (@actions)\nOr try $myCmd -h\n" if ($action eq "");
}
#如果工程是target编译工程,action为空就die
#p_system("perl mediatek/build/tools/flavor_configuration.pl $project $ENV{\"CUSTOM_KERNEL_LCM\"}");
#&writeINI;
my $flavor = "";
if ( $project =~ /\[(.*)\]/ )
{
$flavor = $1;
$project =~ s/\[(.*)\]//;
}
#取flavor值,再project中滤掉flavor
if ($project =~ /^(tablet)/ || $project =~ /_(ph|tb|tv|phone|tablet)$/)
{
my $key = (defined $1)? $1 : "default";
$product = $products->{$key};
}
#project中包以table开头或者包含_以ph tb tv phone tablet等结尾,如果projects根据key转换成对应数据
@acts = split(",", $action);
#从action里面独处act操作
foreach $uAct (@acts)
{
$isFound = 0;
foreach $sAct (@actions)
{
if ($uAct eq $sAct)
{
$isFound = 1;
last;
}
}
die "Unknown the action: $uAct.\nPlease use $myCmd -h, if you need help!\n" if ($isFound == 0);
#判断acts的指令是不是actions数组里面的,如果不是就die
if (($uAct eq "bm_remake") || ($uAct eq "bm_new"))
{
$uAct =~ s/^bm_//;
push(@mOpts, "-k");
}
#如果action以bm_remake或者bm_new开头,去掉bm_,然后往mOpts插入-k
if ($uAct eq "mm")
{
$MM_PATH = shift(@arguments);
die "the given path does not exist!" if (! -d $MM_PATH);
$snod = shift(@arguments) if ($#arguments == 0);
die "the target behind mm must be snod, not $snod" if (($snod ne "") && ($snod ne "snod"));
}
#如果uAct是“mm”,取出后面紧跟的路径,如果路径不存在就die;如果后面还紧跟着取最后一个参数,如果最后一个参数是snod,如果不是"snod"就die,注snod可以打包用。
($uAct = "new") if ($uAct eq "n");
($uAct = "clean") if ($uAct eq "c");
($uAct = "remake") if ($uAct eq "r");
#如果是n c r等简写,则调用对应的全称 new,clean,remake
if (($uAct eq "remake") || ($uAct eq "bm_remake")) #如果是remake或者bm_remake条件
{
unshift(@mOpts, "MTK_DEPENDENCY_AUTO_CHECK=true");#加入依赖检查
if (-e $ini)
{
open (FILE_HANDLE, "<$ini") or die "cannot open $ini\n";
while (
)
{
if (/^(\S+)\s*=\s*(\S+)/)
{
$keyname = $1;
if ($keyname eq "build_mode") {$${keyname} = $2;} #如果是build_mode ,$build_mode = $2
}
}
foreach $i (@mOpts)
{
@temp = split("=","$i");
if ($temp[0] eq "TARGET_BUILD_VARIANT")
{
$TARGET_BUILD_VARIANT = $temp[1];
}
}
if ($TARGET_BUILD_VARIANT eq "") { $TARGET_BUILD_VARIANT = "eng"; } #TARGET_BUILD_VARIAN为"",就是eng方式
if ($build_mode ne $TARGET_BUILD_VARIANT) { print "WARNING *** : Previous build is $build_mode build, and now is $TARGET_BUILD_VARIANT build\n"; }
#ini中的模式和系统带的参数不一致,则报编译warning。
}
}
}
&writeINI;#调用writeINI函数
#print "@acts\n";
my $signSubStr;
if ($action eq "gen-relkey") #action是gen-relkey
{
if ($#arguments >= 0)
{
die "Wrong command line arguments, do NOT set any more arguments after 'gen-relkey'.\n"
. "Please try $myCmd -h for help message.\n";
#action后面不能带任何参数,否则,die
}
else
{
# get signature input
$signSubStr = inputSignSubject();
print "\nYour signature subject is '$signSubStr'\n";
#从inputSignSubject取signSubStr
}
}
else
{
my $i = 0;
if ($#arguments >= 0)
{
foreach $uMod (@arguments)
{
$isFound = 0;
foreach $sMod (@modules) #查找action后面带的是否是modules内的,即android kernel dr k preloader pl lk
{
if ($uMod eq $sMod)
{
$isFound = 1;
last;
}
}
die "Unknown the module: $uMod.\n"
. "It should be one of (@modules)\nOr try $myCmd -h\n"
if ( ($isFound == 0) && ($arguments[$i - 1] !~ /[k|kernel|dr|android]/) );
#module未知,die
($uMod = "preloader") if ($uMod eq "pl");
($uMod = "kernel") if ($uMod eq "k");
($uMod = "android") if ($uMod eq "dr");
#把module简写改为全称
if (($uMod eq "kernel") && ($arguments[$i + 1] =~ /^(.*)\//))
{
$KMOD_PATH = $arguments[$i + 1];
$KMOD_PATH =~ s/^kernel\///;
last;
#如果编译的是kernel并且后面带path,保存KMOD_PATH
}
if ($uMod eq "android")
{
$DR_MODULE = $arguments[$i + 1];
last;
#如果编译的是android并且后面带path,保存DR_MODULE
}
$i += $i + 1;
}
}
else
{
@default_arguments = qw(preloader lk kernel android);
#如果没有带参数,pl lk k dr都是需要的模块。
}
}
#logdir should sync with Makefile.yusu
$ENV{"MTK_PROJECT"} = $project;
#设置环境变量project到MTK_PROJECT中
my $actPttn = join('|', @actions);
#actPttn 用'|'连接所有actions
if (join(' ', @acts) =~ /($actPttn)/ || $project eq "banyan_addon" || $project eq "banyan_addon_x86")
{
#有actions或者模拟器下
($performanceChk == 1) && print &CurrTimeStr . " run pwd\n";
chomp($mktopdir = `pwd`);
($performanceChk == 1) && print &CurrTimeStr . " finish pwd\n";
push(@mOpts, "ENABLE_TEE=$tee");
push(@mOpts, "PROJECT=$project");
push(@mOpts, "FLAVOR=$flavor");
push(@mOpts, "MKTOPDIR=$mktopdir");
push(@mOpts, "PRODUCT=$product");
#往mOpts写入以上变量
if ($action ne "gen-relkey")#非生成key状态。
{
$logdir = "out/target/product";
&p_system("mkdir -p $logdir") if (!-d $logdir); #创建logdir目录
my $ABSActPttn = join('|',@ABSNativeActions);
if (join(' ', @acts) =~ /($ABSActPttn)/) #判断action是否是ABSNativeAction中的。
{
foreach my $act (@acts)
{
&p_system("rm -f $logdir/${project}_${act}.log");
&p_system("rm -f $logdir/${project}_${act}.log_err");
}
#删除对用的log文件。
}
if (join(' ', @acts) =~ /(new|remake|clean)/) #判断action是否是new remake clean等
{
@create_arguments = ($#arguments < 0) ? @default_arguments : @arguments;
foreach $uMod (@create_arguments)
{
#p_system("cat /dev/null > $logdir/${uMod}.log");
&p_system("rm -f $logdir/${project}_${uMod}.log");
&p_system("rm -f $logdir/${project}_${uMod}.log_err");
# &p_system("touch $logdir/${project}_${uMod}.log");
}
#删除所有需要重新actions对应的log文件
}
}
}
$cmdArg = "CMD_ARGU=\"@mOpts\"";
$makeCmd = "make -f mediatek/build/makemtk.mk $cmdArg @mOpts";#real 带编译参数编译make -f makemtk.mkmediatek/build/makemtk.mk mOpts个数 mOpts
#print "$makeCmd\n";
$result = 0;
# gen. release key/certificate
if ($action eq "gen-relkey")
{
print "Start to generate release key/certificate for application signing...\n";
$result += &p_system("$makeCmd $action SIGNATURE_SUBJECT=$signSubStr");
#gen-relkey调用
(exit 255) if ($result >= 255);
exit $result;
}
$result += &p_system("$makeCmd banyan_addon") if($#acts == -1 && $project eq "banyan_addon"); #判断是否编译banyan_addo
$result += &p_system("$makeCmd banyan_addon_x86") if($#acts == -1 && $project eq "banyan_addon_x86"); #判断编译banyan_addon_x86
foreach $uAct (@acts)
{
#对应每种acts做相应操作
if (($uAct eq "codegen") || ($uAct eq "custgen"))
{
$result += &p_system("$makeCmd $uAct"); #code custgen
}
elsif ($uAct eq "mm")
{
$result += &p_system("$makeCmd $uAct SNOD=$snod MM_PATH=$MM_PATH");#mm 编译路径打包
}
else
{
if ($#arguments < 0)
{
if (${uAct} =~ /(new|remake|clean)/)
{
if ($uAct =~ /(new|remake)/)
{
&chkMustEnv;
&chkDep;
}
$result += &p_system("$makeCmd ${uAct}all");#调用正常的命令newall remakeall
}
else
{
$result += &p_system("$makeCmd $uAct CUR_MODULE=android");#缺省模式编译
}
}
else
{
foreach $uMod (@arguments)
{
&chkDep("$uMod");
if ( ($KMOD_PATH ne "") && ($uMod eq "kernel") )
{
$result += &p_system("$makeCmd $uAct CUR_MODULE=$uMod KMOD_PATH=$KMOD_PATH"); #编译kernel模块的某个路径
last;
}
elsif ( ($DR_MODULE ne "") && ($uMod eq "android") )
{
$result += &p_system("$makeCmd $uAct CUR_MODULE=$uMod DR_MODULE=$DR_MODULE"); #编译安卓模块某个路径
last;
}
else
{
$result += &p_system("$makeCmd $uAct CUR_MODULE=$uMod"); #缺省编译
}
}
}
}
}
($performanceChk == 1) && print &CurrTimeStr . " write ini\n";
($performanceChk == 1) && print &CurrTimeStr . " Exit $myCmd\n";
(exit 255) if ($result >= 255);#如果编译错误就退出cmd
exit $result;
sub CurrTimeStr
{
my($sec, $min, $hour, $mday, $mon, $year) = localtime(time);
return (sprintf "%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
}
#返回时间函数
sub Usage
{
warn << "__END_OF_USAGE";
Usage: (makeMtk|mk) [options] project actions [modules]
Options:
-t, -tee : Print log information on the standard-out.
-o, -opt=bypass_argument_to_make
: Pass extra arguments to make.
-h, -help : Print this message and exit.
Projects:
one of available projects.
Actions:
listp, listproject
: List all available projects.
check-env : Check if build environment is ready.
check-dep : Check feature dependency.
n, new : Clean and perform a full build.
c, clean : Clean the immediate files(such as, objects, libraries etc.).
r, remake : Rebuild(target will be updated if any dependency updats).
mrproper : Remove all generated files + config + various backup files in Kbuild process.
bm_new : "new" + GNU make's "-k"(keep going when encounter error) feature.
bm_remake : "remake" + GNU make's "-k"(keep going when encounter error) feature.
mm : Build module through Android native command "mm"
emigen : Generate EMI setting source code.
nandgen : Generate supported NAND flash device list.
codegen : Generate trace DB(for META/Cather etc. tools used).
drvgen : Generate driver customization source.
custgen : Generate customization source.
javaoptgen : Generate the global java options.
ptgen : Generate partition setting header & scatter file.
bindergen : Generate binder related information
sign-image : Sign all the image generated.
encrypt-image : Encrypt all the image generated.
update-api : Android default build action
(be executed if system setting or anything removed from API).
check-modem : Check modem image consistency.
upadte-modem : Update modem image located in system.img.
modem-info : Show modem version
gen-relkey : Generate releasekey for application signing.
check-appres : Check unused application resource.
sdk : Build sdk package.
win_sdk : Build sdk package with a few Windows tools.
banyan_addon : Build MTK sdk addon.
banyan_addon_x86 :Build MTK sdk x86 addon.
cts : Build cts package.
bootimage : Build boot image(boot.img).
cacheimage : Build cache image(cache.img).
systemimage : Build system image(system.img).
snod : Build system image without dependency.
(that is, ONLY pack the system image, NOT checking its dependencies.)
recoveryimage : Build recovery image(recovery.img).
secroimage : Build secro image(secro.img).
factoryimage : Build factory image(factory.img).
userdataimage : Build userdata image(userdata.img).
userdataimage-nodeps
: Build userdata image without dependency.
(that is, ONLY pack the userdata image, NOT checking its dependencies.)
target-files-package
: Build the target files package.
(A zip of the directories that map to the target filesystem.
This zip can be used to create an OTA package or filesystem image
as a post-build step.)
updatepackage : Build the update package.
dist : Build distribution package.
Modules:
pl, preloader : Specify to build preloader.
lk : Specify to build little kernel.
k, kernel : Specify to build kernel.
dr, android : Specify to build android.
NULL : Specify to build all components/modules in default.
k
: Specify to build kernel component/module with the source path.
dr
: Specify to build android component/module with module name. Example: ./mk -t e1k emigen : Generate EMI setting source code. ./mk -o=TARGET_BUILD_VARIANT=user e1k n : Start a user mode full build. ./mk listp : List all available projects. ./mk e1k bootimage : Build bootimage for e1k project. ./mk e1k bm_new k : Build kernel for e1k project. ./makeMtk e1k c,bm_remake pl k : Clean & Build preloader and kernel for e1k project. ./makeMtk e1k n k kernel/xxx/xxx : Build(full build) kernel component/module under the path "kernel/xxx/xxx" for e1k project. ./makeMtk e1k r dr Gallery : Rebuild android module named Gallery for e1k project. ./makeMtk e1k mm packages/apps/Settings : Change Directory to packages/apps/Settings and execute "mm" __END_OF_USAGE exit 1; } #Usage help函数 sub writeINI { @iniFields = qw(project build_mode); open (FILE_HANDLE, ">$ini") or die "cannot open $ini\n"; foreach $m (@iniFields) { foreach $i (@mOpts) { @temp = split("=","$i"); if ($temp[0] eq "TARGET_BUILD_VARIANT") { $build_mode = $temp[1];} } if ($m eq "build_mode" && $build_mode eq "") { print FILE_HANDLE "$m = eng\n"; } else { $value = $${m}; print FILE_HANDLE "$m = $value\n"; } } close FILE_HANDLE; } #写ini函数,第一次编译都会生成,后面编译就采用系统缺省编译模式。 sub p_system { my ($cmd) = @_; my ($debugp) = 0; my $result; ($debugp != 0) && print("$cmd\n"); ($performanceChk == 1) && print &CurrTimeStr . " system $cmd\n"; $result = system("$cmd"); ($performanceChk == 1) && print &CurrTimeStr . " exit $cmd\n"; return $result; } #调用系统cmd函数 sub chkMustEnv { my $result; print "\n**********checking Env************\n"; &p_system("chmod 755 mediatek/build/tools/checkEnv.py"); $result = &p_system("python mediatek/build/tools/checkEnv.py -a >checkenv.log 2>&1"); #调用python脚本检测环境 if ($result == 0) { print " Your building environment is OK\n" . " The detail information is in \"checkenv.log\"!\n" . "*************************************************\n"; } else { print "Please check your building environment First!\n\n"; if ($tee eq "TRUE") { system("cat checkenv.log"); } else { open FILE, "
) { print if(/FAIL|WARNING/); } close(FILE); } die "\n The detail information is in \"checkenv.log\"!\n" . "***********************************************\n"; } } #环境变量检测函数。 sub chkDep { my $module = $_[0]; my $string = $module; if (!$module) { $string = all; } # print "*********************************\n \"$string\" Dependency Checking...\n"; my $result; $result = &p_system("CUR_MODULE=$module make -f mediatek/build/makemtk.mk check-dep $cmdArg @mOpts > $logdir/${project}_check-dep.log 2>&1"); &p_system("cat $logdir/${project}_check-dep.log"); if ($result) { &p_system("cp -f $logdir/${project}_check-dep.log $logdir/${project}_check-dep.log_err"); die "Please check all dependency error First !!"; } } #依赖检测 sub setBuildEnvVars { my $bldProfile = shift; die "\"$bldProfile\" does NOT exist!\n" if (!-e $bldProfile); # Todo: error handling for '. $bldProfile' command my $envVarList = `. $bldProfile && env | grep ".*=.*"`; map { chomp; $ENV{$1}=$2 if (/(.*)=(.*)/); } split(/\n/, $envVarList); if ($DEBUG) { print "[START LOGGING]: Current build environment variables setting...\n"; print "PATH=$ENV{PATH}\n"; print "ANDROID_JAVA_HOME=$ENV{ANDROID_JAVA_HOME}\n"; print "JAVA_HOME=$ENV{JAVA_HOME}\n"; print "PYTHONPATH=$ENV{PYTHONPATH}\n"; print "[END LOGGING]\n"; } } #系统环境变量设置 # interactive mode for inputting signature subject sub inputSignSubject { my $signature = { '0-C' => ['C', '', 'Country Name (2 letter code)'], '1-ST' => ['ST', '', 'State or Province Name (full name)'], '2-L' => ['L', '', 'Locality Name (eg, city)'], '3-O' => ['O', '', 'Organization Name (eg, company)'], '4-OU' => ['OU', '', 'Organizational Unit Name (eg, section)'], '5-CN' => ['CN', '', 'Common Name (eg, your name or your server hostname)'], '6-emailAddress' => ['emailAddress', '', 'Contact email address'] }; my $subjectStr = ""; print "Please enter the signature subject as follows.\n"; foreach my $k (sort keys %$signature) { while (1) { if (!$signature->{$k}[1]) { # print promote message print "$signature->{$k}[2]: "; $signature->{$k}[1] =
; chomp $signature->{$k}[1]; if ($signature->{$k}[1]) { $subjectStr .= "/$signature->{$k}[0]=$signature->{$k}[1]"; last; } } } } return $subjectStr; } #签名输入