@REM *** THE PRIMARY ZIPPING FILE ***
@REM =====================================================================
@REM === SET USER SETTINGS === ie set VERSIONS of ZIP files
@if NOT EXIST zipsetup.bat goto NOSETUP
call zipsetup
@if "%TEMPVERS%x" == "x" goto NOSETUP
@if "%TEMPVERS6%x" == "x" goto NOSETUP
@if "%TEMPVCV%x" == "x" goto NOSETUP
@if "%TEMPVCV6%x" == "x" goto NOSETUP
@REM =====================================================================
@REM 20100117 - Added an EXE zip - just the bin\FlightGear.exe
@REM 20091111 - Add a library ZIP - both static, and dll.lib files, but should also really add headers...
@REM 20081108 - place 'zipsetup' in separate batch, and add DSW/DSP, and add back Openal DLL's
@REM set TEMPVERS=01 - 20080916 - now lpng1232, OSG version, and alut, remove OpenAL
@echo Make ZIP files ... FG CVS OSG %TEMPVCV% ... Version %TEMPVERS% ...

@echo Can use genslnlist.pl to generate a slnlist.txt if changes have occurred
@echo Can use chkslnlist.bat to check each item in slnlist.txt exists ...
@set TEMP2=slnlist.txt
@set TEMP4=zipsln.bat

@echo Use list from cfglist.txt ... make sure it is correct ... now only SG and FG configs ...
@set TEMP3=zipcfg.bat

@REM just zipping the bin folder
@set TEMP5=ziprt.bat

@REM just zipping the bin\bats folder
@set TEMP6=zipbats.bat

@REM ARE THERE ANY MORE CONFIG OR OTHER CHANGES?
@echo Batch diffall.bat can be used to get the diff -ur, and write chgdiffNN.txt 
@echo IFF diff and fixf32 in PATH, and per my folders ...
@echo chglistNN.txt should contain the files FIXED during the build
@set TEMP7=zipchg.bat
@echo DELETE chglistNN.txt IF THERE IS NO CHANGES
@set TEMP8=chglist%TEMPVERS%.txt

@set TEMP9=README.fgfs.htm

@REM 20081108 - Added VC6 DSW/DSP zipping
@set TEMP10=zipdsp.bat
@set TEMP11=dsplist.txt
@set TEMP12=zipoal.bat

@REM 20081128 - Added 'boost' zipping
@set TEMP13=zipboost.bat
@set TEMP14=zipplib.bat

@REM 20091111 - Add 'lib' zipping
@set TEMP15=ziplibs.bat
@set TEMP15B=ziplibs.txt

@set TEMPZ1=fg%TEMPVCV%rt%TEMPVERS%.zip
@set TEMPZ2=rfgbats%TEMPVERS%.zip
@set TEMPZ3=%TEMPVCV%cfg%TEMPVERS%.zip
@set TEMPZ4=%TEMPVCV%chg%TEMPVERS%.zip
@REM This is the MAIN zip, to contain ALL (or most)
@set TEMPZ5=%TEMPVCV%sln%TEMPVERS%.zip
@set TEMPZ6=%TEMPVCV6%dsw%TEMPVERS6%.zip
@set TEMPZ7=OpenAL-%TEMPVERS%.zip
@set TEMPZ8=boost-%TEMPVERS%.zip
@REM 20090312 - Added the PLIB zip
@set TEMPZ9=%TEMPVCV%PLIB-%TEMPVERS%.zip
@set TEMPZ10=%TEMPVCV%-libs-%TEMPVERS%.zip
@set TEMPZ11=fg%TEMPVCV%-exe-%TEMPVERS%.zip

@REM Check for essential existance
@REM ****************************
@if NOT EXIST %TEMP2% goto ERR2
@if NOT EXIST %TEMP3% goto ERR3
@if NOT EXIST %TEMP4% goto ERR4
@if NOT EXIST %TEMP5% goto ERR5
@if NOT EXIST %TEMP6% goto ERR6
@if NOT EXIST %TEMP7% goto ERR7
@echo Checking for CHANGES... be unusual if NONE...
@if NOT EXIST %TEMP8% goto DNCHG1
@echo Including %TEMP8% CHANGES ...
@goto DNCHGES
:DNCHG1
@echo Can NOT locate %TEMP8%, so assume NO CHANGES...
@echo *** CHECK THIS UNUSUAL ITEM ***
:DNCHGES
@REM if NOT EXIST %TEMP9% goto ERR9
@if NOT EXIST %TEMP10% goto ERR10
@if NOT EXIST %TEMP11% goto ERR11
@if NOT EXIST %TEMP12% goto ERR12
@if NOT EXIST %TEMP14% goto ERR14
@if NOT EXIST %TEMP15% goto ERR15
@if NOT EXIST %TEMP15B% goto ERR15B
@REM ****************************

@if NOT EXIST C:\MDOS\clobnow.bat goto NOCLOB
@call clobnow > nul
@cd bin
@call clobnow > nul
@cd bats
@call clobnow > nul
@cd ..\..
@echo Done cleanup of any temp*, *.bak, etc ...
@goto DNCLOB
:NOCLOB
@echo Have you checked all 'temp' files have been removed?
:DNCLOB
@echo Continue? Ctrl+C to abort ...
@pause

@REM Second check ...
@echo.
@echo ************************************************
@echo LAST CHANCE! Is everything ready to create zips?
@if EXIST *.zip @echo NOTE: ALL previous ZIPS will be deleted ...
@echo ************************************************
@echo.
@pause

@if EXIST *.zip echo Removing previous zips 
@if EXIST *.zip del *.zip > nul

@REM call zip8 -a -o %TEMPZ5% %TEMP9%
@REM if NOT EXIST %TEMPZ5% goto NOZIP5
call %TEMP5%
@if NOT EXIST %TEMPZ1% goto NOZIP1
call %TEMP6%
@if NOT EXIST %TEMPZ2% goto NOZIP2
call %TEMP3%
@if NOT EXIST %TEMPZ3% goto NOZIP3
@if NOT EXIST %TEMP8% goto DNCHG2
@call %TEMP7%
@if NOT EXIST %TEMPZ4% goto NOZIP4
:DNCHG2
call %TEMP4%
@if NOT EXIST %TEMPZ5% goto NOZIP5
call %TEMP10%
@if NOT EXIST %TEMPZ6% goto NOZIP6
@REM Zip OpenAL runtime into TEMPZ7
call %TEMP12%
@if NOT EXIST %TEMPZ7% goto NOZIP7
call %TEMP13%
@if NOT EXIST %TEMPZ8% goto NOZIP8
call %TEMP14%
@if NOT EXIST %TEMPZ9% goto NOZIP9
call %TEMP15%
@if NOT EXIST %TEMPZ10% goto NOZIP10

@REM Combine zips, and add in additional files in the ROOT
call zip8 -a -o %TEMPZ5% %TEMPZ2% %TEMPZ3% %TEMPZ4% *.bat *.txt *.mak *.pl *.patch %TEMPZ6% %TEMPZ8% %TEMPZ9%
@REM Add OpenAL RT into runtime zip
call zip8 -a -o %TEMPZ1% %TEMPZ7%
@REM And JUST the EXE
call zip8 -a -o %TEMPZ11% bin\FlightGear.exe
@if NOT EXIST %TEMPZ11% goto NOZIP11

@REM Clean up zips now included
@if EXIST %TEMPZ2% del %TEMPZ2% 
@if EXIST %TEMPZ3% del %TEMPZ3%
@if EXIST %TEMPZ4% del %TEMPZ4%
@if EXIST %TEMPZ6% del %TEMPZ6%
@if EXIST %TEMPZ7% del %TEMPZ7%
@if EXIST %TEMPZ8% del %TEMPZ8%
@if EXIST %TEMPZ9% del %TEMPZ9%

@REM Show ZIPS created
@REM call zip8 -vb %TEMPZ1%
@call zip8 -vb %TEMPZ5% *.zip
@dir *.zip

@REM Abandon NET saving ...
@goto END

@if "%COMPUTERNAME%x" == "DELL02x" goto DODELL02
savetod2 %TEMPZ1%
savetod2 %TEMPZ5%
@goto END
:DODELL02
savetod1 %TEMPZ1%
savetod1 %TEMPZ5%
@goto END

:NOZIP1
@echo Unable to create %TEMPZ1% ... aborting
@goto END
:NOZIP2
@echo Unable to create %TEMPZ2% ... aborting
@goto END
:NOZIP3
@echo Unable to create %TEMPZ3% ... aborting
@goto END
:NOZIP4
@echo Unable to create %TEMPZ4% ... aborting
@goto END
:NOZIP5
@echo Unable to create %TEMPZ5% ... aborting
@goto END
:NOZIP6
@echo ERROR: Unable to create %TEMPZ6% ... aborting
@goto END
:NOZIP7
@echo ERROR: Unable to create %TEMPZ7% ... aborting
@goto END
:NOZIP8
@echo ERROR: Unable to create %TEMPZ8% ... aborting
@goto END
:NOZIP9
@echo ERROR: Unable to create %TEMPZ9% ... aborting
@goto END
:NOZIP10
@echo ERROR: Unable to create %TEMPZ10% ... aborting
@goto END
:NOZIP11
@echo ERROR: Unable to create %TEMPZ11% ... aborting
@goto END

:ERR2
@echo Unable to locate %TEMP2% ... aborting ...
@goto END
:ERR3
@echo Unable to locate %TEMP3% ... aborting ...
@goto END
:ERR4
@echo Unable to locate %TEMP4% ... aborting ...
@goto END
:ERR5
@echo Unable to locate %TEMP5% ... aborting ...
@goto END
:ERR6
@echo Unable to locate %TEMP6% ... aborting ...
@goto END
:ERR7
@echo Unable to locate %TEMP7% ... aborting ...
@goto END
:ERR8
@echo Unable to locate %TEMP8% ... aborting ...
@goto END
:ERR9
@echo Unable to locate %TEMP9% ... aborting ...
@goto END
:ERR10
@echo ERROR: Unable to locate %TEMP10% ... aborting ...
@goto END
:ERR11
@echo ERROR: Unable to locate %TEMP11% ... aborting ...
@goto END
:ERR12
@echo ERROR: Unable to locate %TEMP12% ... aborting ...
@goto END
:ERR14
@echo ERROR: Unable to locate %TEMP14% ... aborting ...
@goto END
:ERR15
@echo ERROR: Unable to locate %TEMP15% ... aborting ...
@goto END
:ERR15B
@echo ERROR: Unable to locate %TEMP15B% ... aborting ...
@goto END

:NOSETUP
@echo ERROR: Environment variables for versions NOT set ...
@echo NEED TEMPVERS, TEMPVERS6, TEMPVCV, and TEMPVCV6
@echo Theses are all SET through the zipsetup.bat file
@goto END

:END
