Building the iMAME installer.
Glenn Neidermeier, 04JUN02


REFERENCES

C:\Windows CE Tools\wce300\MS Pocket PC\samples\win32\APPINST
C:\Windows CE Tools\wce300\MS Pocket PC\support\ActiveSync\windows ce application installation


FILES (in addition to iMAME source code download)
 imame_appinst.zip - download from www.mameworld.net/imame/imame_appinst.zip
 http://www.microsoft.com/mobile/pocketpc/downloads/devdownloads.asp


1 - SETUP THE CAB PACKAGE WORK AREA

mkdir APPINST (i'll refer to it as $APPINST from now on)

$APPINST should be in the same directory level as your iMAME source work directory.
Refer to $APPINST/build.bat for what path is assumed.


Download GAPI and extract the zip to $APPINST (here is the current GAPI URL)
 http://www.microsoft.com/mobile/pocketpc/downloads/devdownloads.asp


GAPI.zip extraction creates directory $APPINST/arm.
Inside $APPINST/arm, you find the gx.dll for arm.
All platform-specific binary components are loaded into the CAB file from this directory, 
 particularly, the iMAME executable file. This directory is referenced in the INF
 file in the section SourceDisksNames as follows:
                               [SourceDisksNames.PPC30_ARM]
                               2 = ,"PPC30 ARM Files",,arm



2 - BUILD THE CAB

cd $APPINST

The file $APPINST/build.bat contains all the commands to generate the CAB file and 
 self-extracting executable installer.
 The batch file points to the location of the cabwiz.exe program which is installed with
 your Pocket PC SDK. (edit the batch-file if SDK installed differently on your system).
 NOTE that I am running this on Win98SE and had to increase the environment variable setting
 for the DOS command box.


Run the batch file $APPINST/build.bat

The batch file will copy the executable (release version) from your EVC++
work area object directory, to the directory $APPINST/arm/imame.exe

Check the file $APPINST/imame.err for any errors

Copy the file imame.ppc30_arm.CAB to the device, then launch it
 in the Pocket PC File Explorer, to check the basic CAB functionality.
 


3 - BUILD THE INSTALL PROGRAM

 The setup program is a Visual C++ 6.0 project, based on EZSetup by Scott Ludwig.
 It extracts the CAB file and uses the Active Sync connection to install the software.
 Updates to EZSetup are found at:
   http://www.eskimo.com/~scottlu
 I based my setup program on the 1.0 version of the EZSetup install program.
 
 The EXSetup program has been horribly hacked to use the unzip540 sources from info-zip. 
 The original info-zip sources are at:
  ftp://ftp.info-zip.org/pub/infozip/src/
 But I am distributing the necessary parts of info-zip with this project.
  
 More information is in the file $APPINST/install/setup/gandalf_setup_readme.txt
 or at least as much information as I cared to put down at the time :)

IMPORTANT 
 When the setup.exe program is being compiled, some files must
 exist in the build directory. A small batch file 'files.bat' creates these for you.
 
 Open the workspace $APPINST/install/setup/setup.dsw and build release versions of both projects.
 The setup executable is at $APPINST/install/setup/release/setup.exe



4 - CREATE THE SELF_EXTRACTING ZIP DISTRIBUTION FILE

 Remember the build.bat program we were running? It creates a zip file, contents as follows:

 * license.txt (copy of the GPL found in MAME sources, it gets displayed in 
  a text box window as the self-extracting installer is extracting the CAB file)
 
 * imame.ppc30_arm.CAB - the output of the build.bat file, found in $APPINST
 
 * ReadmeiMAME.txt - readme for iMAME
 
 * imame.ini - it is used by Active Sync CE Services to install you application
 

 The self-extracting executable is created by appending the zip-file to the
 setup executable stub-program. 
 
 The setup executable is at $APPINST/install/setup/release/setup.exe
 
 The following commands in build.bat create the self-extracting executable:
  copy /b setup.exe+imame.zip imame261_006arm.exe
  zip -A imame261_006arm.exe 
  
  
 The zip command comes from the fine folks at info-zip (see URL above) 
 I used zip23.tar.gz  
 
 Extract the zip-2.3 source. 
 Rename the zip-2.3 to simply "zip"
 ZIP sources should be in the same directory level as your iMAME source work directory and your
  $APPINST directory.
 Refer to $APPINST/build.bat for what path is assumed.
 
 To build the zip program, use the makefile makefile.w32
 
 As per the instruction in the Makefile.w32, be sure to do the following:
  # Add -DNO_ASM to CFLAGS and comment out the ASMOBJS definition if
  # you do not have masm 6.1X.
 
 To use the makefile with nmake, do "nmake -f makefile.w32"
 
 Note- getting nmake in your command-environment path is a matter of 
  running the following script: 
 C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat
