一个build脚本欣赏

build scripts

My basic build.bat file looks like this:

@echo off
erase ThemeChanger*.exe
copy ../Loader/ArmRel/Loader.exe ./
copy ../Setupdll/ArmRel/setup.dll ./
copy ../ArmRel/ThemeChanger.exe ./
copy ../ThemeChangerChTr/ArmRel/*.mui ./
copy ../ThemeChangerDa/ArmRel/*.mui ./
copy ../ThemeChangerEn/ArmRel/*.mui ./
copy ../ThemeChangerFr/ArmRel/*.mui ./
copy ../ThemeChangerIt/ArmRel/*.mui ./
copy ../ThemeChangerPo/ArmRel/*.mui ./
copy ../ThemeChangerGe/ArmRel/*.mui ./
"C:/Program Files/Windows CE Tools/wce300/SMARTPHONE 2002/Tools/cabwizsp.exe" Theme_Changer_SP2002.STRONGARM.inf /postxml postinstall.xml
erase Theme_Changer_SP2002.STRONGARM.cab
rename Theme_Changer_SP2002.cab Theme_Changer_SP2002.STRONGARM.cab
ezsetup -l english -i ThemeChanger.ini -r readme.txt -e eula.txt -o ThemeChanger_setup.exe
tagnzip ThemeChanger_setup ThemeChanger Theme_Changer_SP2002.STRONGARM.cab

I copy the built files over, note don't do this in the Post-Build step of EVC as the files won't be signed. I then build my cab manually, which I find is the most powerful. ezsetup is a setup exe creater which is free, if you don't need to install files on the PC I highly recommend it, it creates exe's MUCH smaller than commercial offerings I have used.
Lastly I zip it up using pkzip 2.50 (which has long filename support) and its ready for uploading to the web.

and tagnzip looks this this:

@echo off

rem move %1.exe %2MAJOR_MINOR.exe

echo move %1.exe %2> t1.bat
grep "MAJOR" ../majorminor.h | cut -d" " -f3 >>t1.bat
echo _>> t1.bat
grep "MINOR" ../majorminor.h | cut -d" " -f3 | tr -d "L""" >>t1.bat
echo .exe >> t1.bat
tr -d '/n/r' < t1.bat > t2.bat
erase t1.bat
call t2.bat
erase t2.bat

rem pkzip -a -n+ %2MAJOR_MINOR.zip %2MAJOR_MINOR.exe

echo pkzip -a -n+ %2%lt; t1.bat
grep "MAJOR" ../majorminor.h | cut -d" " -f3 >>t1.bat
echo _>> t1.bat
grep "MINOR" ../majorminor.h | cut -d" " -f3 | tr -d "L""" >>t1.bat
echo .zip >> t1.bat
echo %2>> t1.bat
grep "MAJOR" ../majorminor.h | cut -d" " -f3 >>t1.bat
echo _>> t1.bat
grep "MINOR" ../majorminor.h | cut -d" " -f3 | tr -d "L""" >>t1.bat
echo .exe >> t1.bat
tr -d '/n/r' < t1.bat > t2.bat
erase t1.bat
call t2.bat
erase t2.bat

rem move %3 %2MAJOR_MINOR.cab

echo move %3 %2> t1.bat
grep "MAJOR" ../majorminor.h | cut -d" " -f3 >>t1.bat
echo _>> t1.bat
grep "MINOR" ../majorminor.h | cut -d" " -f3 | tr -d "L""" >>t1.bat
echo .cab >> t1.bat
tr -d '/n/r' < t1.bat > t2.bat
erase t1.bat
call t2.bat
erase t2.bat

@echo on

The native windows ports of these UNIX tools (tr, grep, and cut) are availble here: UnxUtils. Getting a commandline version of pkzip 2.50+ is a bit trickier, as I don't believe its available now.

My .inf file looks like this:

[Version]
Signature = "$Windows NT$"
Provider = "Rikisoft" ; maximum of 30 characters, full app name will be "<Provider> <AppName>"
CESignature = "$Windows CE$"

[CEStrings]
AppName = "Theme Changer" ; maximum of 40 characters, full app name will be "<Provider> <AppName>"
InstallDir=%CE1%/ThemeChanger/ ; /PSM/Program Files/ThemeChanger/

[SourceDisksNames]
1 = , "Common Files",,

[SourceDisksFiles]
setup.dll = 1
ThemeChanger.exe = 1
ThemeChanger.exe.0404.mui = 1
ThemeChanger.exe.0406.mui = 1
ThemeChanger.exe.0407.mui = 1
ThemeChanger.exe.0409.mui = 1
ThemeChanger.exe.040c.mui = 1
ThemeChanger.exe.0410.mui = 1
ThemeChanger.exe.0415.mui = 1

[DefaultInstall]
CopyFiles = CopyToThemeChanger
CEShortcuts = Shortcuts1
CESetupDLL = setup.dll

[DestinationDirs]
CopyToThemeChanger = 0, %InstallDir%
Shortcuts1 = 0,%CE11% ; Install in /PSM/Windows/Start Menu/

[CopyToThemeChanger]
"ThemeChanger.exe", ThemeChanger.exe
"ThemeChanger.exe.0404.mui", ThemeChanger.exe.0404.mui
"ThemeChanger.exe.0407.mui", ThemeChanger.exe.0407.mui
"ThemeChanger.exe.0406.mui", ThemeChanger.exe.0406.mui
"ThemeChanger.exe.0409.mui", ThemeChanger.exe.0409.mui
"ThemeChanger.exe.040c.mui", ThemeChanger.exe.040c.mui
"ThemeChanger.exe.0410.mui", ThemeChanger.exe.0410.mui
"ThemeChanger.exe.0415.mui", ThemeChanger.exe.0415.mui

[Shortcuts1]
%AppName%,0,ThemeChanger.exe

it's all pretty standard, note the shortcut which points to the loader. If your having trouble with it there are plenty of helpful pages on the web.
And lastly my .ini file

[CEAppManager]
Version = 1.0
Component = Theme Changer

[Theme Changer]
Description = "Advanced .CAB Theme Changer"
Uninstall = "Rikisoft Theme Changer"
CabFiles = Theme_Changer_SP2002.STRONGARM.cab

Again run of the mill.

General Tips

Lastly I include some tips and tricks I've picked up, most people won't need them, but from time to time they might answer someones question, so keep them in mind, you might use them one day.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值