commit b8ed3894104c2f36777b72b331d582eab18524da Author: DarthArgus Date: Sat Jan 20 13:55:01 2018 -0600 add the build tools diff --git a/README.md b/README.md new file mode 100644 index 0000000..b40038f --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# Star Wars Galaxies Source Code (C++) Build Tools + +This is the main server code. Please feel free to contribute merge/pull requests, or fork the code to create variations. Please keep the license and credit information intact. + +The majority of the work is thanks to Devcodex, with more fixes and optimizations provided by DarthArgus. + +# src Repo: +# Main Branches +* master - stable, no debug flags +* testing - bleeding edge, works in progress, probably stable + +# Works in progress +* testing-64 - fully 64 bit version thatbuilds but doesn't run, some typedefs and things are wrong + +# Building + +Only use the Debug and Release targets unless you want to work on 64 bit. For local testing, and non-live builds set MODE=Release or MODE=debug in build_linux.sh. + +For production, user facing builds, set MODE=MINSIZEREL for profile built, heavily optimized versions of the binaries. + +## Profiling and Using Profiles + +To generate new profiles, build SWG with MODE=RELWITHDEBINFO. + +Add export LLVM_PROFILE_FILE="output-%p.profraw" to your startServer.sh file. + +WHILE THE SERVER IS RUNNING do a ps -a to get the pid's of each SWG executable. And take note of which ones are which. + +After you cleanly exit (shutdown) the server, and ctrl+c the LoginServer, move each output-pid.profraw to a folder named for it's process. + +Then, proceed to combine them into usable profiles for the compiler: + +llvm-profdata merge -output=code.profdata output-*.profraw + +Finally, then replace the profdata files with the updated versions, within the src/ tree. + +See http://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation for more information. + +# Buy Darth A Caffinated Beverage + +bitcoin:16e1QRRmnBmod3RLtdDMa5muKBGRXE3Kmh diff --git a/build_linux.sh b/build_linux.sh new file mode 100755 index 0000000..b5d8842 --- /dev/null +++ b/build_linux.sh @@ -0,0 +1,330 @@ +#!/bin/bash + +basedir=$PWD +PATH=$PATH:$basedir/build/bin +DBSERVICE= +DBUSERNAME= +DBPASSWORD= +HOSTIP= +CLUSTERNAME= +NODEID= +DSRC_DIR= +DATA_DIR= +GIT_URL="https://darth-swg@bitbucket.org/stellabellumswg/dsrc.git" +GIT_REPO_SRC=${GIT_URL}src.git +GIT_REPO_DSRC=${GIT_URL}dsrc.git +GIT_REPO_CONFIG=${GIT_URL}configs.git +GIT_REPO_DATA=${GIT_URL}data.git + +# Debug and Release are for testing and not public servers, they lack optimizations +MODE=Release +#MODE=Debug + +# Public/high load release builds - heavily optimized bins +#MODE=MINSIZEREL + +# Builds binaries to generate profdata +#MODE=RELWITHDEBINFO + +if [ ! -d $basedir/build ] +then + mkdir $basedir/build +fi + +if [ ! -f $basedir/.setup ]; then + if [[ $(lsb_release -a) =~ .*Ubuntu.* ]] || [ -f "/etc/debian_version" ] + then + read -p "!!!ONLY RUN ONCE!!! Do you want to install dependencies (y/n)?" response + response=${response,,} # tolower + if [[ $response =~ ^(yes|y| ) ]]; then + $basedir/utils/init/debian.sh + source /etc/profile.d/java.sh + source /etc/profile.d/oracle.sh + touch $basedir/.setup + + echo "Please login and out or reboot as changes have been made to your PATH " + fi + fi +fi + +read -p "Do you want to pull/update git? (y/n) " response +response=${response,,} # tolower +if [[ $response =~ ^(yes|y| ) ]]; then + # update main repo + git pull + + # update or clone each sub-repo + if [ ! -d $basedir/src ]; then + git clone $GIT_REPO_SRC src + else + cd $basedir/src + git pull + cd $basedir + fi + + if [ ! -d $basedir/dsrc ]; then + git clone $GIT_REPO_DSRC dsrc + else + cd $basedir/dsrc + git pull + cd $basedir + fi + + if [ ! -d $basedir/configs ]; then + git clone $GIT_REPO_CONFIG configs + else + cd $basedir/configs + git pull + cd $basedir + fi +fi + +read -p "Do you want to recompile the server code (C++) now? (y/n) " response +response=${response,,} # tolower +if [[ $response =~ ^(yes|y| ) ]]; then + cd $basedir/build + + # prefer clang + if type clang &> /dev/null; then + export CC=clang + export CXX=clang++ + fi + + if [ $(arch) == "x86_64" ]; then + export LDFLAGS=-L/usr/lib32 + export CMAKE_PREFIX_PATH="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu" + + cmake -DCMAKE_C_FLAGS=-m32 \ + -DCMAKE_CXX_FLAGS=-m32 \ + -DCMAKE_EXE_LINKER_FLAGS=-m32 \ + -DCMAKE_MODULE_LINKER_FLAGS=-m32 \ + -DCMAKE_SHARED_LINKER_FLAGS=-m32 \ + -DCMAKE_BUILD_TYPE=$MODE \ + $basedir/src + else + cmake $basedir/src -DCMAKE_BUILD_TYPE=$MODE + fi + + make -j$(nproc) + + if [[ $MODE =~ ^(Release) ]]; then + strip -s bin/* + fi + + cd $basedir +fi + +read -p "Do you want to build the config environment now? (y/n) " response +response=${response,,} # tolower +if [[ $response =~ ^(yes|y| ) ]]; then + + # Prompt for configuration environment. + read -p "Configure environment (local, live, tc, design)? You probably want local. " config_env + + # Make sure the configuration environment exists. + if [ ! -d $basedir/configs/$config_env ]; then + echo "Invalid configuration environment." + exit + fi + + + echo "Enter your IP address (LAN for port forwarding or internal, outside IP for DMZ)" + read HOSTIP + + echo "Enter the DSN for the database connection " + read DBSERVICE + + echo "Enter the database username " + read DBUSERNAME + + echo "Enter the database password " + read DBPASSWORD + + echo "Enter a name for the galaxy cluster " + read CLUSTERNAME + + if [ -d $basedir/exe ]; then + rm -rf $basedir/exe + fi + + mkdir -p $basedir/exe/linux/logs + mkdir -p $basedir/exe/shared + + ln -s $basedir/build/bin $basedir/exe/linux/bin + + cp -u $basedir/configs/$config_env/linux/* $basedir/exe/linux + cp -u $basedir/configs/$config_env/shared/* $basedir/exe/shared + + for filename in $(find $basedir/exe -name '*.cfg'); do + sed -i -e "s@DBSERVICE@$DBSERVICE@g" -e "s@DBUSERNAME@$DBUSERNAME@g" -e "s@DBPASSWORD@$DBPASSWORD@g" -e "s@CLUSTERNAME@$CLUSTERNAME@g" -e "s@HOSTIP@$HOSTIP@g" $filename + done + + # + # Generate other config files if their template exists. + # + + # Generate at least 1 node that is the /etc/hosts IP. + $basedir/utils/build_node_list.sh +fi + +if [ ! -d $basedir/data ]; then + read -p "Symlink to data directory (y/n)? " remote_dsrc_response + remote_dsrc_response=${remote_dsrc_response,,} + if [[ $remote_dsrc_response =~ ^(yes|y| ) ]]; then + read -p "Enter target data directory " DATA_DIR + ln -s $DATA_DIR ./data + fi +fi + +read -p "Do you want to recompile the scripts (.java)? (y/n) " response +response=${response,,} # tolower +if [[ $response =~ ^(yes|y| ) ]]; then + #prepare environment to run data file builders + oldPATH=$PATH + PATH=$basedir/build/bin:$PATH + + read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response + response=${response,,} + if [[ $response =~ ^(multi|m| ) ]]; then + $basedir/utils/build_java_multi.sh + else + $basedir/utils/build_java.sh + fi + + PATH=$oldPATH +fi + +buildTemplates=false + +read -p "Do you want to build the mIFF files (.mif)? (y/n) " response +response=${response,,} +if [[ $response =~ ^(yes|y| ) ]]; then + #prepare environment to run data file builders + oldPATH=$PATH + PATH=$basedir/build/bin:$PATH + + $basedir/utils/build_miff.sh + + buildTemplates=true + + PATH=$oldPATH +fi + +read -p "Do you want to build the datatables (.tab)? (y/n) " response +response=${response,,} +if [[ $response =~ ^(yes|y| ) ]]; then + #prepare environment to run data file builders + oldPATH=$PATH + PATH=$basedir/build/bin:$PATH + + read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response + response=${response,,} + if [[ $response =~ ^(multi|m| ) ]]; then + $basedir/utils/build_tab_multi.sh + else + $basedir/utils/build_tab.sh + fi + + buildTemplates=true + + PATH=$oldPATH +fi + +read -p "Do you want to build the template files (.tpf)? (y/n) " response +response=${response,,} +if [[ $response =~ ^(yes|y| ) ]]; then + #prepare environment to run data file builders + oldPATH=$PATH + PATH=$basedir/build/bin:$PATH + + read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response + response=${response,,} + if [[ $response =~ ^(multi|m| ) ]]; then + $basedir/utils/build_tpf_multi.sh + else + $basedir/utils/build_tpf.sh + fi + + buildTemplates=true + + PATH=$oldPATH +fi + +if [[ $buildTemplates = false ]]; then + read -p "Do you want to build the Object Template or Quest CRC files? (y/n) " response + response=${response,,} + if [[ $response =~ ^(yes|y| ) ]]; then + buildTemplates=true + fi +fi + +templatesLoaded=false + +if [[ $buildTemplates = true ]]; then + echo "Object Template and Quest CRC files will now be built and re-imported into the database." + + if [[ -z "$DBSERVICE" ]]; then + echo "Enter the DSN for the database connection " + read DBSERVICE + fi + + if [[ -z "$DBUSERNAME" ]]; then + echo "Enter the database username " + read DBUSERNAME + fi + + if [[ -z "$DBPASSWORD" ]]; then + echo "Enter the database password " + read DBPASSWORD + fi + + #prepare environment to run data file builders + oldPATH=$PATH + PATH=$basedir/build/bin:$PATH + + $basedir/utils/build_object_template_crc_string_tables.py + $basedir/utils/build_quest_crc_string_tables.py + + cd $basedir/src/game/server/database + + echo "Loading template list" + + perl ./templates/processTemplateList.pl < $basedir/dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql + sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out + + templatesLoaded=true + + cd $basedir + PATH=$oldPATH +fi + +read -p "Import database? (y/n) " response +response=${response,,} +if [[ $response =~ ^(yes|y| ) ]]; then + cd $basedir/src/game/server/database/build/linux + + if [[ -z "$DBSERVICE" ]]; then + echo "Enter the DSN for the database connection " + read DBSERVICE + fi + + if [[ -z "$DBUSERNAME" ]]; then + echo "Enter the database username " + read DBUSERNAME + fi + + if [[ -z "$DBPASSWORD" ]]; then + echo "Enter the database password " + read DBPASSWORD + fi + + ./database_update.pl --username=$DBUSERNAME --password=$DBPASSWORD --service=$DBSERVICE --goldusername=$DBUSERNAME --loginusername=$DBUSERNAME --createnewcluster --packages + + if [[ $templatesLoaded = false ]]; then + echo "Loading template list" + perl ../../templates/processTemplateList.pl < ../../../../../../dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql + sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out + fi +fi + +echo "Build complete!" diff --git a/sid_readme_priv.md b/sid_readme_priv.md new file mode 100644 index 0000000..8d92d71 --- /dev/null +++ b/sid_readme_priv.md @@ -0,0 +1,134 @@ +# Debian SID SWGMasters Developer VM (PRIVATE REPO ONLY) + +## Download +(not currently available) + +### Special Notes for Image v6 +If you're using version 6 of the development image, you'll need to do a few things prior to being able to start the server (but AFTER all other steps): +- Add the compiled binary locations to the PATH variable + +```export PATH=$PATH:/home/swg/swg-main/build/bin``` + +- You'll also need to possibly edit the build_linux.sh script (located in the swg-main folder) and set the MODE equal to "Debug" instead of "Release". If you run into issues +starting the server for the first time, set to Debug, recompile the server, rebuild the templates (the compile script step below), truncate your OBJECT_TEMPLATES table and +re-import your database. + +## System Requirements + +* Virtualbox 5.0.x +* 4GB RAM minimum (The VM supports 64GB RAM) +* 30GB Harddisk Space + +Recommended: +* SSH-Client (Putty in Windows) +* SCP-Client (WinSCP) +* more RAM if you want to run more then 1-2 Zones +* SSD as VM Storage + +## What's Included In The VM + +* Debian SID/Testing 32Bit +* OracleDB 11g Release 2 +* Oracle Enterprise Manager https://:1158/em/console (User: SYSTEM Pass: swg) +* Clientfiles needed to start the server /home/swg/clientdata/ +* Appearance Files needed to start the server /home/swg/appearance/ +* Copy of https://bitbucket.org/swgmasters/swg-src/ /home/swg/swg-src/ +* All predependecies installed to compile your own server +* Samba preinstalled pointed to /home/swg/ (You can use editors/IDEs or/and your git in Windows) +* Dummy-X-Server to run X-Applications through VNC (Isnt started by default, google vnc4server) + +Default Password: swg + +## What Do You Need To Do To Get A Server Running? + +Import the Appliance to Virtualbox. +* CPU Setting PAE +* Network Setting: Bridge Network + +Change the /etc/hosts file to the right ipaddress. + + nano /etc/hosts + +Change the 192.168.2.113 to the IP of the Virtual Machine + + swg + +Restart the server: + + shutdown -r now + +Download Putty and point it to the IP of your VM +Login as user swg with password swg + +Delete the public repo (You can skip this, if you want to build both binarysets on the same system) + + rm /home/swg/swg-src -rf + +Create an ssh-key to use with the private gitlab as user swg + + ssh-keygen -t rsa + +Copy the public key to your gitlab account settings. (Profile Settings -> SSH-Keys) + + cat /home/swg/.ssh/id_rsa.pub + +After this you can download the private main repo: + + cd /home/swg + git clone git@git.stellabellum.net:staff/swg-main.git + +When you are done with the git clone part, go into the swg-main folder + + cd /home/swg/swg-main + touch .setup + +Start the Download of other Repos by using the build_linux.sh git pull/push option. + + ./build_linux.sh + !! Ignore the install dependencies PART !! + +## Building Phases +Follow the instructions. The binary building phase will take roughly 1h/1Core. +The Script Building Phase will throw errors if you skip the configphase, do configs first, then scriptbuilding. + +### Config Phase +use local + +Database DSN: +//127.0.0.1/swg + +Database User: +swg + +Database Password: +swg + +### Script Building +Scriptbuilding will take about 6hours the first time. You can later just recompile single scripts or tab files, look at the +utils/build_ and the build_linux.sh files to see the syntax of the mocha, javac and compilertools. + +### Database +The Clustername has to be the same you used in the configphase. The same for the nodeip. The other settings are self-explaining. + +## Clientdata and Appearance Files +The Clientdata Repo is copied from our Git here, its in /home/swg/clientdata. http://git.stellabellum.net/staff/clientdata + +The .git Folder is removed to save space! + +You need to modify: +* exe/shared/servercommon.cfg + + [SharedFile] + searchPath2=../../data/sku.0/sys.shared/compiled/game + searchPath2=../../data/sku.0/sys.server/compiled/game + searchPath1=../../data/sku.0/sys.shared/built/game + searchPath1=../../data/sku.0/sys.server/built/game + searchPath0=../../data/sku.0/sys.client/compiled/clientdata + +* mkdir /home/swg/swg-main/data/sku.0/sys.client/compiled +* ln -s /home/swg/clientdata /home/swg/swg-main/data/sku.0/sys.client/compiled/clientdata + +## First Start + ./startServer.sh + +Point your login.cfg to the IP of the Virtualmachine. diff --git a/startServer.sh b/startServer.sh new file mode 100755 index 0000000..930c19b --- /dev/null +++ b/startServer.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +cd exe/linux + +export LLVM_PROFILE_FILE="output-%p.profraw" + +killall LoginServer &> /dev/null +killall CentralServer &> /dev/null +killall ChatServer &> /dev/null +killall CommoditiesServer &> /dev/null +killall ConnectionServer &> /dev/null +killall CustomerServiceServer &> /dev/null +killall LogServer &> /dev/null +killall MetricsServer &> /dev/null +killall PlanetServer &> /dev/null +killall ServerConsole &> /dev/null +killall SwgDatabaseServer &> /dev/null +killall SwgGameServer &> /dev/null +killall TransferServer &> /dev/null + +./bin/LoginServer -- @servercommon.cfg & + +sleep 5 + +./bin/TaskManager -- @servercommon.cfg diff --git a/startWithLogging.sh b/startWithLogging.sh new file mode 100755 index 0000000..601d64c --- /dev/null +++ b/startWithLogging.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +bash startServer.sh |& tee output.log diff --git a/tools/AddressToLine.exe b/tools/AddressToLine.exe new file mode 100644 index 0000000..2c2ad94 Binary files /dev/null and b/tools/AddressToLine.exe differ diff --git a/tools/AutomatedDailyBuild.pl b/tools/AutomatedDailyBuild.pl new file mode 100755 index 0000000..29463df --- /dev/null +++ b/tools/AutomatedDailyBuild.pl @@ -0,0 +1,146 @@ +#!/usr/bin/perl -w +use File::Find; +use BuildFunctions; + + +### + # Copyright (C)2000-2002 Sony Online Entertainment Inc. + # All Rights Reserved + # + # Title: AutomatedDailyBuild.pl + # Description: Forces a sync to current, syncs to head, builds all_Client, SWGGameServer, PlanetServer, and SwgLoadServer and check for writable files in the src directory then emails log files to gmcdaniel. + # @author $Author: gmcdaniel $ + # @version $Revision: #17 $ + ## + + +## +# This subroutine finds any non-authorized writable files in a passed directory + +sub Find_Writable +{ + if (-d $_) + { + # found a directory entry + + # prune the directory if it's one we want to ignore + if (m/^(compile)$/) + { + #prune it + $File::Find::prune = 1; + } + } + elsif (-f and -w $_) + { if (!m/^.*(aps|ncb|opt|plg)$/) + { + print "n $File::Find::name\n"; + print Logfile "n $File::Find::name\n"; + } + } +} # End of sub Find_Writable + + + +########## MAIN ########## + + + +## +# Delete compile directory for clean build + + system("c:\\4nt302\\4nt /c del /s /y ..\\src\\compile"); + +# +## End of Delete compile directory for clean build + + + +## +# Sync Code to Head + + print ("Beginning Sync to Head...\n"); + # sync client that points to d:\workdaily + system ("p4 -c gmcdaniel-wxp-gmcdaniel-build-station-machine_daily_build sync //depot/swg...\#head"); + print ("Sync Complete\n"); + print ("\n"); + print ("\n"); + +# +## End of Sync Code to Head + + + +## +# Forced Code + + print ("Beginning Forced Sync...\n"); + # sync client that points to d:\workdaily + system ("p4 -c gmcdaniel-wxp-gmcdaniel-build-station-machine_daily_build sync -f //depot/swg...\#have"); + print ("Sync Complete\n"); + print ("\n"); + print ("\n"); + +# +## End of Forced Sync + + + + +## +# Build Projects and Check for Errors + + build_project ("_all_client"); + Check_For_Warnings_and_Errors("_all_client"); + + #build_project ("PlanetServer"); + #Check_For_Warnings_and_Errors("PlanetServer"); + + #build_project ("SwgGameServer"); + #Check_For_Warnings_and_Errors("SwgGameServer"); + + #build_project ("SwgLoadClient"); + #Check_For_Warnings_and_Errors("SwgLoadClient"); + +# +## End of Build Projects and Check for Errors + + + + + +## +# Check for any non-authorized writable files in the /swg/current/src directory and email the results + + + + ### Email addresses + #$gmcdaniel = "gmcdaniel\@soe.sony.com"; + + + #$writable_files_log = "WritableFiles.log"; + + #print ("Checking for writable files...\n"); + #open (Logfile, ">d:\\buildlogs\\$writable_files_log") || die "Sorry, I couldn't create $writable_files_log"; + #print Logfile "The writable files that were found:\n"; + + # do a find + #$search_path = "..\\src"; + #@ARGV = ($search_path); + #find(\&Find_Writable, @ARGV); + + #close (Logfile); + + #$writable_test_time_and_date = get_time_and_date(); + #$date_stamp = get_date(); + #system ("copy d:\\buildlogs\\$writable_files_log d:\\buildlogs\\WritableFiles_$writable_test_time_and_date.log"); + #print ("Checking for writable files completed\n"); + #print ("\n"); + #print ("\n"); + #system ("postie -host:sdt-mx1.station.sony.com -to:$gmcdaniel -from:$gmcdaniel -s:\"Writable Files Results $date_stamp\" -nomsg -file:d:\\buildlogs\\WritableFiles_$writable_test_time_and_date.log"); + +# +## End of Check for any non-authorized writable files in the /swg/current/src directory and email the results + + + +########## END OF MAIN ########## diff --git a/tools/AutomatedDailyServerBuild.pl b/tools/AutomatedDailyServerBuild.pl new file mode 100755 index 0000000..433480f --- /dev/null +++ b/tools/AutomatedDailyServerBuild.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w + + + +########## MAIN ########## + + + +## +# + + + print ("Synching to head\n"); + system ("p4 sync \#head"); + print ("End of sync to head\n"); + + print ("Cleaning process...\n"); + system ("make -C ./work/swg/current/src/build/linux/ cleanall"); + print ("Cleaning Process Complete\n"); + + + print ("Starting Debug Server Build\n"); + system ("make -C ./work/swg/current/src/build/linux/ debug 2>&1 | tee grant debug.log"); + print ("Debug Server Build Complete\n"); + print ("\n"); + + print ("Cleaning process...\n"); + system ("make -C ./work/swg/current/src/build/linux/ cleanall"); + print ("Cleaning Process Complete\n"); + + + print ("Starting Release Server Build\n"); + system ("make -C ./work/swg/current/src/build/linux/ release 2>&1 | tee grantrelease.log"); + print ("Release Server Build Complete\n"); + print ("Mailing debug log"); + system ("mail -s \"[BUILDLOG] Daily Debug Server Log\" gmcdaniel\@soe.sony.com cmayer\@soe.sony.com asommers\@soe.sony.com jgrills\@soe.sony.com jbrack\@soe.sony.com dirs.txt +for ddd in (@dirs.txt) gosub dddd +del /e /z /q dirs.txt +quit 0 + +:dddd +echo %ddd +cd %ddd +call BuildIncludeHeaderFiles +cd .. +return diff --git a/tools/BuildAllDsps.btm b/tools/BuildAllDsps.btm new file mode 100644 index 0000000..762fbd3 --- /dev/null +++ b/tools/BuildAllDsps.btm @@ -0,0 +1,14 @@ +@echo off + +set tmpFile=_allDsps.tmp + +c:\cygwin\bin\find ../src -name "settings.rsp" > %tmpFile + +perl -pi.bak -e"s/\/(\w*)\/build\/win32\/settings\.rsp/\/$1\/build\/win32\/$1\.dsp/g;" %tmpFile + +cat %tmpFile +xargs p4 edit < %tmpFile + +for %file in (@%tmpFile) do (echo Building %file & buildDsp.pl %file) +xargs p4 revert -a < %tmpFile +rm %tmpFile \ No newline at end of file diff --git a/tools/BuildAllVcproj.btm b/tools/BuildAllVcproj.btm new file mode 100644 index 0000000..28bfbf9 --- /dev/null +++ b/tools/BuildAllVcproj.btm @@ -0,0 +1,3 @@ +@echo off + +perl buildAllVcproj.pl diff --git a/tools/BuildBetaPatcherVersion.btm b/tools/BuildBetaPatcherVersion.btm new file mode 100644 index 0000000..e0fe240 --- /dev/null +++ b/tools/BuildBetaPatcherVersion.btm @@ -0,0 +1,44 @@ +@echo off +if not exist "SwgClient_r.exe" goto error +set dd=%_date +set dn=patcher_20%@instr[6,2,%dd]%@instr[0,2,%dd]%@instr[3,2,%dd]beta + +inkey Press ESC to abort creating patcher version %dn: %%key +if "%@ascii[%key]" == "27" goto :end + + +md \%dn + +copy /u h:\gmcdaniel\public\patch_trees\*.tre \%dn + +copy /u SwgClient_r.exe \%dn +copy /u dpvs.dll \%dn +copy /u dpvsd.dll \%dn +copy /u gl04_r.dll \%dn +copy /u dbghelp.dll \%dn +copy /u DllExport.dll \%dn +copy /u template_patcher_client.cfg \%dn\client.cfg +copy /u mss32.dll \%dn +md \%dn\miles +copy /u miles\*.* \%dn\miles\ + + + +goto end + +:error +echo You must run this from the exe\win32 directory! +goto end + + + + + +pushd /%dn +del \\sdlux2\projects\pc\patch\starwars\game\*.tre +copy /u *.* \\sdlux2\projects\pc\patch\starwars\game +popd +popd +start http://laser:7000 +pause +:end diff --git a/tools/BuildChanges.pl b/tools/BuildChanges.pl new file mode 100755 index 0000000..086c033 --- /dev/null +++ b/tools/BuildChanges.pl @@ -0,0 +1,86 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +sub usage +{ + die "usage: $0 [-i] [-t] perforce_file_spec start_changelist end_changelist\n" . + "\t-i show internal notes\n" . + "\t-t show testplan\n"; +} + +my $showInternal = 0; +my $showTestplan = 0; + +usage() if (@ARGV < 3); +while ($ARGV[0] eq "-i" || $ARGV[0] eq "-t") +{ + $showInternal = 1 if ($ARGV[0] eq "-i"); + $showTestplan = 1 if ($ARGV[0] eq "-t"); + shift; +} + +my $spec = shift; +my $first = shift; +my $last = shift; + +open(P4, "p4 changes $spec\@$first,$last |"); +my @changes = ; +close(P4); + +foreach (@changes) +{ + chomp; + s/'.*//; + my $changeline = $_; + s/^Change //; + s/ .*//; + my $change = $_; + + open(P4, "p4 describe -s $change |"); + my $public = ""; + my $internal = ""; + my $testplan = ""; + my $junk = ""; + my $section = "junk"; + while () + { + if (s/^\t//) + { + if (/\[public\]/) + { + $section = "public"; + } + elsif (/\[internal\]/) + { + $section = "internal"; + } + elsif (/\[testplan\]/) + { + $section = "testplan"; + } + elsif (/\[/) + { + $section = "junk"; + } + elsif ($_ ne "\n") + { + $public .= $_ if ($section eq "public"); + $internal .= $_ if ($section eq "internal"); + $testplan .= $_ if ($section eq "testplan"); + } + } + else + { + $section = "junk"; + } + } + close(P4); + + print $changeline,"\n" if ($public ne "" || ($showInternal && $internal ne "") || ($showTestplan && $testplan ne "")); + print "[public]\n", $public, "\n" if ($public ne ""); + print "[internal]\n", $internal, "\n" if ($showInternal && $internal ne ""); + print "[testplan]\n", $testplan, "\n" if ($showTestplan && $testplan ne ""); + print "\n\n" if ($public ne "" || $internal ne "" || $testplan ne ""); +} diff --git a/tools/BuildDsp.pl b/tools/BuildDsp.pl new file mode 100755 index 0000000..d76b9f3 --- /dev/null +++ b/tools/BuildDsp.pl @@ -0,0 +1,1603 @@ +#!/usr/bin/perl +# ===================================================================== + +# figure out what project file we're building +$project = $ARGV[0]; +die "no project name specified" if (!defined($project)); + +# lop off the directories +$project =~ s#^.*[/\\]##; + +# lop off the extension +$project =~ s#\.dsp$##; + +# capitalize the first letter of the string +$Project = $project; +substr($Project,0,1) =~ tr/a-z/A-Z/; + +# get the directory path, paths need to be relative to the project files +$directory = $ARGV[0]; +if ($directory =~ s#[/\\][^/\\]+$## != 0) +{ + chdir($directory) || die "could not change into directory ". $directory; +} + +# ===================================================================== + +# setup defaults +@defines_debug = ("WIN32", "_DEBUG", "_MBCS", "DEBUG_LEVEL=2"); +@defines_optimized = ("WIN32", "_DEBUG", "_MBCS", "DEBUG_LEVEL=1"); +@defines_release = ("WIN32", "NDEBUG", "_MBCS", "DEBUG_LEVEL=0"); + +$fixQt = 0; + +$optimizedOptimizations = " /Ox /Ot /Og /Oi /Oy-"; +$dbgInfo_d = makeDebugInfoFlag("pdb"); +$dbgInfo_o = makeDebugInfoFlag("pdb"); +$dbgInfo_r = makeDebugInfoFlag("pdb"); +$minimalRebuild = " /Gm"; + +# ===================================================================== +# process RSP files + +open(RSP, "settings.rsp") || die "could not open settings.rsp for " . $project . ", "; +while () +{ + # handle comments + s/#.*//; + + foreach (split) + { + if ($_ eq "windows") + { + $output = $template_windows; + push(@defines_debug, "_WINDOWS"); + push(@defines_optimized, "_WINDOWS"); + push(@defines_release, "_WINDOWS"); + } + elsif ($_ eq "mfc") + { + $output = $template_mfc; + push(@defines_debug, "_WINDOWS"); + push(@defines_optimized, "_WINDOWS"); + push(@defines_release, "_WINDOWS"); + } + elsif ($_ eq "qt334") + { + $output = $template_windows; + push(@defines_debug, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + push(@defines_optimized, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + push(@defines_release, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + $qt_version = "3.3.4"; + $fixQt = 1; + } + elsif ($_ eq "qt410" || $_ eq "qt") + { + $output = $template_windows; + push(@defines_debug, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT", "QT3_SUPPORT"); + push(@defines_optimized, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT", "QT3_SUPPORT"); + push(@defines_release, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT", "QT3_SUPPORT"); + $qt_version = "4.1.0"; + $fixQt = 1; + } + elsif ($_ eq "console") + { + $output = $template_console; + push(@defines_debug, "_CONSOLE"); + push(@defines_optimized, "_CONSOLE"); + push(@defines_release, "_CONSOLE"); + } + elsif ($_ eq "library") + { + $output = $template_library; + + push(@defines_debug, "_LIB"); + push(@defines_optimized, "_LIB"); + push(@defines_release, "_LIB"); + } + elsif ($_ eq "utility") + { + $output = $template_utility; + } + elsif ($_ eq "noPchDirectory") + { + $noPchDir = 1; + } + elsif ($_ eq "stdafx") + { + $stdafx = 1; + } + elsif ($_ eq "p4") + { + push(@defines_debug, "CASE_INSENSITIVE", "OS_NT"); + push(@defines_optimized, "CASE_INSENSITIVE", "OS_NT"); + push(@defines_release, "CASE_INSENSITIVE", "OS_NT"); + } + elsif ($_ eq "unicode") + { + push(@defines_debug, "_UNICODE", "UNICODE"); + push(@defines_optimized, "_UNICODE", "UNICODE"); + push(@defines_release, "_UNICODE", "UNICODE"); + } + elsif (s/^Zm//) + { + $zm = " /Zm" . $_ . " "; + } + elsif (s/^dbgInfo_d_//) + { + $dbgInfo_d = makeDebugInfoFlag($_); + } + elsif (s/^dbgInfo_o_//) + { + $dbgInfo_o = makeDebugInfoFlag($_); + } + elsif (s/^dbgInfo_r_//) + { + $dbgInfo_r = makeDebugInfoFlag($_); + } + elsif (s/^incremental_d_//) + { + $incremental_d = " /incremental:" . $_; + } + elsif (s/^incremental_o_//) + { + $incremental_o = " /incremental:" . $_; + } + elsif (s/^incremental_r_//) + { + $incremental_r = " /incremental:" . $_; + } + elsif (/Gm-/) + { + $minimalRebuild = " /Gm-"; + + } + elsif ($_ eq "copyDev") + { + $copyDev = 1; + } + elsif ($_ eq "debugInline") + { + $debugInline = " /Ob1"; + } + elsif ($_ eq "disableOptimizationsInOpt") + { + $optimizedOptimizations = " /Od /Oy-"; + } + else + { + die "unknown option ", $_, "\n"; + } + } +} +close(RSP); + +# read in the includes list +push(@defines_debug, process_rsp("defines_d.rsp", "defines.rsp")); +push(@defines_optimized, process_rsp("defines_o.rsp", "defines.rsp")); +push(@defines_release, process_rsp("defines_r.rsp", "defines.rsp")); + +# read in the includes list +@includeDirectories_debug = process_rsp("includePaths_d.rsp", "includePaths.rsp"); +@includeDirectories_optimized = process_rsp("includePaths_o.rsp", "includePaths.rsp"); +@includeDirectories_release = process_rsp("includePaths_r.rsp", "includePaths.rsp"); + +# get in the libraries +@libraries_debug = process_rsp("libraries_d.rsp", "libraries.rsp"); +@libraries_optimized = process_rsp("libraries_o.rsp", "libraries.rsp"); +@libraries_release = process_rsp("libraries_r.rsp", "libraries.rsp"); + +# get the libraries to ignore +@ignoreLibraries_debug = process_rsp("ignoreLibraries_d.rsp", "ignoreLibraries.rsp"); +@ignoreLibraries_optimized = process_rsp("ignoreLibraries_o.rsp", "ignoreLibraries.rsp"); +@ignoreLibraries_release = process_rsp("ignoreLibraries_r.rsp", "ignoreLibraries.rsp"); + +# get the libraries search directory paths +@libraryDirectories_debug = process_rsp("libraryPaths_d.rsp", "libraryPaths.rsp"); +@libraryDirectories_optimized = process_rsp("libraryPaths_o.rsp", "libraryPaths.rsp"); +@libraryDirectories_release = process_rsp("libraryPaths_r.rsp", "libraryPaths.rsp"); + + +if ($fixQt) +{ + fixup_qt_path(@includeDirectories_debug); + fixup_qt_path(@includeDirectories_optimized); + fixup_qt_path(@includeDirectories_release); + fixup_qt_path(@libraryDirectories_debug); + fixup_qt_path(@libraryDirectories_optimized); + fixup_qt_path(@libraryDirectories_release); + + fixup_qt_lib(@libraries_debug); + fixup_qt_lib(@libraries_optimized); + fixup_qt_lib(@libraries_release); +} + + +# ===================================================================== +# scan the current vcproj looking for per-file settings to preserve + +if (open(DSP, $project . ".dsp")) +{ + while () + { + s/\r//; + + # look for per-file settings to preserve + if ($state == 1) + { + if ($_ eq "# End Source File\n") + { + $state = 0; + } + else + { + $settings{$filename} .= $_; + } + } + if ($state == 0 && s/^SOURCE=//) + { + chomp; + s/^"//; + s/"$//; + $filename = $_; + $state = 1; + } + } + close(DSP); +} + +# override the custom build steps for headers that need moc'ed +open(RSP, "mocHeaders.rsp"); +while () +{ + chomp; + + # handle comments + s/#.*//; + + # clean up the input + s/^\s+//; + s/\s+$//; + s#/#\\#g; + + if ($_ ne "") + { + # get just the file name + $name = $_; + $name =~ s#^.*\\##; + $name =~ s#\..*$##; + + $settings{$_} = $mocHeader; + $settings{$_} =~ s/%%inputPath%%/$_/g; + $settings{$_} =~ s/%%inputName%%/$name/g; + } +} +close(RSP); + + +# ===================================================================== +# + +sub makeDebugInfoFlag +{ + my $input = $_[0]; + local $flag = ""; + local $_; + + if ( $input eq "line_numbers_only" ) + { + $flag = " /Zd"; + } + elsif ( $input eq "pdb" ) + { + $flag = " /Zi"; + } + elsif ( $input eq "edit_and_continue" ) + { + $flag = " /ZI"; + } + elsif ( $input eq "none" ) + { + $flag = ""; + } + else + { + die "Unknown setting for dbgInfo: $input\n"; + } + + return $flag; +} + +sub fixup_qt_path +{ + foreach (@_) + { + s/qt\\[0-9]\.[0-9]\.[0-9]/qt\\$qt_version/; + } +} + +sub fixup_qt_lib +{ + my $qtlibver = $qt_version; + $qtlibver =~ s/\.//g; + + foreach (@_) + { + s/qt-mt[0-9][0-9][0-9]/qt-mt$qtlibver/; + } +} + + +# ===================================================================== +# find all the non-linux source files + +sub addfile +{ + my $pathed = $_[0]; + local $_ = $pathed; + + # lop off the directories + s#.*/##; + s#.*\\##; + + if (/\.cpp$/) + { + $sourceNames{$_} = $pathed; + } + elsif (/\.h$/) + { + $headerNames{$_} = $pathed; + } + elsif (/\.def$/) + { + $headerNames{$_} = $pathed; + $settings{$pathed} = "# PROP Exclude_From_Build 1\n"; + } + elsif (/\.ui$/) + { + $uiNames{$_} = $pathed; + + $settings{$pathed} = $ui; + $settings{$pathed} =~ s/%%inputPath%%/$pathed/g; + $noExt = $_; + $noExt =~ s/\.ui$//; + $settings{$pathed} =~ s/%%inputName%%/$noExt/g; + } + elsif (/\.template$/) + { + $templateNames{$_} = $pathed; + } + elsif (/\.rc$/) + { + $resourceNames{$_} = $pathed; + } + elsif (/\.ico$/ || /\.cur$/ || /\.bmp$/) + { + $resourceNames{$_} = $pathed; + } +} + +sub dodir +{ + local $_; + my $dir = $_[0]; + + opendir(DIR, $dir) || return; + my @filenames = readdir(DIR); + closedir(DIR); + + for (@filenames) + { + next if $_ eq "."; + next if $_ eq ".."; + + $pathed = $dir . "\\" . $_; + + if (-d $pathed) + { + next if ($_ eq "linux"); + next if ($_ eq "solaris"); + &dodir($pathed); + } + else + { + &addfile($pathed); + } + } +} +&dodir("..\\..\\src"); +&dodir("..\\..\\src_oci"); +&dodir("..\\..\\src_odbc"); +&dodir("..\\..\\ui"); + +# get any additional files to include in the build +open(RSP, "additionalFiles.rsp"); +while () +{ + # handle comments + s/#.*//; + + chomp; + s/\s+$//; + &addfile($_) if ($_ ne ""); +} +close(RSP); + +# ===================================================================== +# process all the source files + +# Make sure all First*.cpp projects build the PCH + +$_ = $settings{$sourceNames{"First$Project.cpp"}}; + +if (! /.*\/Yc.*/ ) +{ + $settings{$sourceNames{"First$Project.cpp"}} = $_ . "\n# ADD CPP /Yc\n"; +} + +foreach (sort { lc($a) cmp lc($b) } keys %sourceNames) +{ + $_ = $sourceNames{$_}; + $sources .= "# Begin Source File\n\nSOURCE=$_\n$settings{$_}# End Source File\n"; +} + +foreach (sort { lc($a) cmp lc($b) } keys %headerNames) +{ + $_ = $headerNames{$_}; + $headers .= "# Begin Source File\n\nSOURCE=$_\n$settings{$_}# End Source File\n"; +} + +foreach (sort { lc($a) cmp lc($b) } keys %resourceNames) +{ + $_ = $resourceNames{$_}; + $resources .= "# Begin Source File\n\nSOURCE=$_\n$settings{$_}# End Source File\n"; +} + +foreach (sort { lc($a) cmp lc($b) } keys %templateNames) +{ + $_ = $templateNames{$_}; + $templates .= "# Begin Source File\n\nSOURCE=$_\n$settings{$_}# End Source File\n"; +} + +foreach (sort { lc($a) cmp lc($b) } keys %uiNames) +{ + $_ = $uiNames{$_}; + $uis .= "# Begin Source File\n\nSOURCE=$_\n$settings{$_}# End Source File\n"; + + s/^.*[\\\/]//; + s/\.ui$//; + + $uiGeneratedSources_debug .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Debug\\${_}_d.cpp\n$debug_ui_cpp# End Source File\n"; + $uiGeneratedHeaders_debug .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Debug\\$_.h\n# End Source File\n"; + $uiGeneratedSources_optimized .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Optimized\\${_}_o.cpp\n$optimized_ui_cpp# End Source File\n"; + $uiGeneratedHeaders_optimized .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Optimized\\$_.h\n# End Source File\n"; + $uiGeneratedSources_release .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Release\\${_}_r.cpp\n$release_ui_cpp# End Source File\n"; + $uiGeneratedHeaders_release .= "# Begin Source File\n\nSOURCE=..\\..\\..\\..\\..\\..\\compile\\win32\\%%project%%\\Release\\$_.h\n# End Source File\n"; +} + +# ===================================================================== +# set up the replacements + +# setup the replacement strings +$replace{"%%project%%"} = $project; +$replace{"%%sources%%\n"} = $sources; +$replace{"%%headers%%\n"} = $headers; +$replace{"%%resources%%\n"} = $resources; +$replace{"%%templates%%\n"} = $templates; +$replace{" %%debugInline%%"} = $debugInline; +$replace{" %%dbgInfo_r%%"} = $dbgInfo_r; +$replace{" %%dbgInfo_o%%"} = $dbgInfo_o; +$replace{" %%dbgInfo_d%%"} = $dbgInfo_d; +$replace{" %%incremental_r%%"} = $incremental_r; +$replace{" %%incremental_o%%"} = $incremental_o; +$replace{" %%incremental_d%%"} = $incremental_d; +$replace{" %%minimalRebuild%%"} = $minimalRebuild; +$replace{" %%optimizedOptimizations%%"} = $optimizedOptimizations; +$replace{" %%zm%%"} = $zm; +$replace{" %%includeDirectories_debug%%"} = explode("/I \"", "\"", @includeDirectories_debug); +$replace{" %%includeDirectories_optimized%%"} = explode("/I \"", "\"", @includeDirectories_optimized); +$replace{" %%includeDirectories_release%%"} = explode("/I \"", "\"", @includeDirectories_release); +$replace{" %%defines_debug%%"} = explode("/D \"", "\"", @defines_debug); +$replace{" %%defines_optimized%%"} = explode("/D \"", "\"", @defines_optimized); +$replace{" %%defines_release%%"} = explode("/D \"", "\"", @defines_release); +$replace{" %%libraries_debug%%"} = explode("", "", @libraries_debug); +$replace{" %%libraries_optimized%%"} = explode("", "", @libraries_optimized); +$replace{" %%libraries_release%%"} = explode("", "", @libraries_release); +$replace{" %%libraryDirectories_debug%%"} = explode("/libpath:\"", , "\"", @libraryDirectories_debug); +$replace{" %%libraryDirectories_optimized%%"} = explode("/libpath:\"", , "\"", @libraryDirectories_optimized); +$replace{" %%libraryDirectories_release%%"} = explode("/libpath:\"", , "\"", @libraryDirectories_release); +$replace{" %%ignoreLibraries_debug%%"} = explode("/nodefaultlib:\"", , "\"", @ignoreLibraries_debug); +$replace{" %%ignoreLibraries_optimized%%"} = explode("/nodefaultlib:\"", , "\"", @ignoreLibraries_optimized); +$replace{" %%ignoreLibraries_release%%"} = explode("/nodefaultlib:\"", , "\"", @ignoreLibraries_release); + +$replace{"%%uis%%"} = $uis; +$replace{"%%uiGeneratedSources_debug%%"} = $uiGeneratedSources_debug; +$replace{"%%uiGeneratedHeaders_debug%%"} = $uiGeneratedHeaders_debug; +$replace{"%%uiGeneratedSources_optimized%%"} = $uiGeneratedSources_optimized; +$replace{"%%uiGeneratedHeaders_optimized%%"} = $uiGeneratedHeaders_optimized; +$replace{"%%uiGeneratedSources_release%%"} = $uiGeneratedSources_release; +$replace{"%%uiGeneratedHeaders_release%%"} = $uiGeneratedHeaders_release; + +$replace{"%%qt_version%%"} = $qt_version; + +if ($copyDev) +{ + $replace{"%%specialBuildTool_release%%\n"} = $specialBuildTool_release; + $replace{"%%specialBuildTool_optimized%%\n"} = $specialBuildTool_optimized; + $replace{"%%specialBuildTool_debug%%\n"} = $specialBuildTool_debug; +} +else +{ + $replace{"%%specialBuildTool_release%%\n"} = ""; + $replace{"%%specialBuildTool_optimized%%\n"} = ""; + $replace{"%%specialBuildTool_debug%%\n"} = ""; +} + +if ($copyDev) +{ + $replace{"%%postBuild_release%%\n"} = $postBuild_release; + $replace{"%%postBuild_optimized%%\n"} = $postBuild_optimized; + $replace{"%%postBuild_debug%%\n"} = $postBuild_debug; +} +else +{ + $replace{"%%postBuild_release%%\n"} = ""; + $replace{"%%postBuild_optimized%%\n"} = ""; + $replace{"%%postBuild_debug%%\n"} = ""; +} + +if ($copyDev) +{ + $replace{"%%preLink_release%%\n"} = ""; + $replace{"%%preLink_optimized%%\n"} = ""; + $replace{"%%preLink_debug%%\n"} = ""; +} +else +{ + $replace{"%%preLink_release%%\n"} = ""; + $replace{"%%preLink_optimized%%\n"} = ""; + $replace{"%%preLink_debug%%\n"} = ""; +} + +if ($copyDev) +{ + $replace{"%%copyDev_release%%"} = "copy \$(TargetPath) ..\\..\\..\\..\\..\\..\\..\\dev\\win32\\%%project%%_r.exe"; + $replace{"%%copyDev_optimized%%"} = "copy \$(TargetPath) ..\\..\\..\\..\\..\\..\\..\\dev\\win32\\%%project%%_o.exe"; + $replace{"%%copyDev_debug%%"} = "copy \$(TargetPath) ..\\..\\..\\..\\..\\..\\..\\dev\\win32\\%%project%%_d.exe"; +} +else +{ + $replace{"%%copyDev_release%%"} = ""; + $replace{"%%copyDev_optimized%%"} = ""; + $replace{"%%copyDev_debug%%"} = ""; +} + +if ($stdafx) +{ + $replace{"%%pch%%"} = "StdAfx.h"; +} +else +{ + if ($noPchDir) + { + $replace{"%%pch%%"} = "First" . $Project . ".h"; + } + else + { + $replace{"%%pch%%"} = $project . "\\First" . $Project . ".h"; + } +} + +# ===================================================================== + +# do all the replacements repeatedly until no more replacements can be made +do +{ + $changed = 0; + foreach $key (keys %replace) + { + $changed += $output =~ s/$key/$replace{$key}/; + } +} while ($changed > 0); + +# convert newlines to cr/lf sequences +$output =~ s/\n/\cM\cJ/g; + +# save the output +open(DSP, ">" . $project . ".dsp") || die "could not open project file " . $project . ".dsp for writing\n"; +binmode(DSP); +print DSP $output; +close(DSP); + +# ===================================================================== + +BEGIN +{ + +sub process_rsp +{ + local $_; + my @rsp; + while (@_) + { + open(RSP, shift @_); + while () + { + chomp; + + # handle comments + s/#.*//; + + s/\s+$//; + tr/\//\\/; + push(@rsp, $_) if ($_ ne ""); + } + close(RSP); + } + return @rsp; +} + +sub explode +{ + local $_; + my $result = ""; + my $prefix = shift @_; + my $suffix = shift @_; + + foreach (@_) + { + $result .= " " . $prefix . $_ . $suffix; + } + return $result; +} + +# --------------------------------------------------------------------- + +$template_library = +q@# Microsoft Developer Studio Project File - Name="%%project%%" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=%%project%% - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak" CFG="%%project%% - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "%%project%% - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "%%project%% - Win32 Optimized" (based on "Win32 (x86) Static Library") +!MESSAGE "%%project%% - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "%%project%%" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W4 /WX /GR /GX %%dbgInfo_r%% /O2 %%includeDirectories_release%% %%defines_release%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Optimized" +# PROP BASE Intermediate_Dir "Optimized" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_o%% %%optimizedOptimizations%% /Gf %%includeDirectories_optimized%% %%defines_optimized%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_d%% /Od %%debugInline%% %%includeDirectories_debug%% %%defines_debug%% /Yu"%%pch%%" /FD %%zm%% /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "%%project%% - Win32 Release" +# Name "%%project%% - Win32 Optimized" +# Name "%%project%% - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;rc" +%%sources%% +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "def;h;hpp;inl" +%%headers%% +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +%%resources%% +# End Group +# Begin Group "Template Files" + +# PROP Default_Filter "template" +%%templates%% +# End Group +# End Target +# End Project +@; + +# --------------------------------------------------------------------- + +$template_windows = +q@# Microsoft Developer Studio Project File - Name="%%project%%" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=%%project%% - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak" CFG="%%project%% - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "%%project%% - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "%%project%% - Win32 Optimized" (based on "Win32 (x86) Application") +!MESSAGE "%%project%% - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "%%project%%" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W4 /WX /GR /GX %%dbgInfo_r%% /O2 %%includeDirectories_release%% %%defines_release%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 %%libraries_release%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_release%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Release\%%project%%_r.exe" /pdbtype:sept %%libraryDirectories_release%% %%incremental_r%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_release%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Optimized" +# PROP BASE Intermediate_Dir "Optimized" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_o%% %%optimizedOptimizations%% /Gf %%includeDirectories_optimized%% %%defines_optimized%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_optimized%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_optimized%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Optimized\%%project%%_o.exe" /pdbtype:sept %%libraryDirectories_optimized%% %%incremental_o%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_optimized%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_d%% /Od %%debugInline%% %%includeDirectories_debug%% %%defines_debug%% /Yu"%%pch%%" /FD %%zm%% /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_debug%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_debug%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Debug\%%project%%_d.exe" /pdbtype:sept %%libraryDirectories_debug%% %%incremental_d%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_debug%% + +!ENDIF + +# Begin Target + +# Name "%%project%% - Win32 Release" +# Name "%%project%% - Win32 Optimized" +# Name "%%project%% - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;rc" +%%sources%% +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "def;h;hpp;inl" +%%headers%% +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +%%resources%% +# End Group +# Begin Group "Template Files" + +# PROP Default_Filter "template" +%%templates%% +# End Group +# Begin Group "Ui Files" + +# PROP Default_Filter "ui" +%%uis%% +# End Group +# Begin Group "Ui Generated Files" + +# PROP Default_Filter "" +# Begin Group "Release" + +# PROP Default_Filter "" +# Begin Group "Release Ui Source Files" + +# PROP Default_Filter "" +%%uiGeneratedSources_release%% +# End Group +# Begin Group "Release Ui HeaderFiles" + +# PROP Default_Filter "" +%%uiGeneratedHeaders_release%% +# End Group +# End Group +# Begin Group "Optimized" + +# PROP Default_Filter "" +# Begin Group "Optimized Ui Source Files" + +# PROP Default_Filter "" +%%uiGeneratedSources_optimized%% +# End Group +# Begin Group "Optimized Ui Header Files" + +# PROP Default_Filter "" +%%uiGeneratedHeaders_optimized%% +# End Group +# End Group +# Begin Group "Debug" + +# PROP Default_Filter "" +# Begin Group "Debug Ui Source Files" + +# PROP Default_Filter "" +%%uiGeneratedSources_debug%% +# End Group +# Begin Group "Debug Ui Header Files" + +# PROP Default_Filter "" +%%uiGeneratedHeaders_debug%% +# End Group +# End Group +# End Group +# End Target +# End Project +@; + + +# --------------------------------------------------------------------- + +$template_mfc = +q@# Microsoft Developer Studio Project File - Name="%%project%%" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=%%project%% - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak" CFG="%%project%% - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "%%project%% - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "%%project%% - Win32 Optimized" (based on "Win32 (x86) Application") +!MESSAGE "%%project%% - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "%%project%%" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W4 /WX /GR /GX %%dbgInfo_r%% /O2 %%includeDirectories_release%% %%defines_release%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 %%libraries_release%% /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_release%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Release\%%project%%_r.exe" /pdbtype:sept %%libraryDirectories_release%% %%incremental_r%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_release%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Optimized" +# PROP BASE Intermediate_Dir "Optimized" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_o%% %%optimizedOptimizations%% /Gf %%includeDirectories_optimized%% %%defines_optimized%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_optimized%% /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_optimized%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Optimized\%%project%%_o.exe" /pdbtype:sept %%libraryDirectories_optimized%% %%incremental_o%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_optimized%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_d%% /Od %%debugInline%% %%includeDirectories_debug%% %%defines_debug%% /Yu"%%pch%%" /FD %%zm%% /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_debug%% /nologo /subsystem:windows /debug /machine:I386 %%ignoreLibraries_debug%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Debug\%%project%%_d.exe" /pdbtype:sept %%libraryDirectories_debug%% %%incremental_d%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_debug%% + +!ENDIF + +# Begin Target + +# Name "%%project%% - Win32 Release" +# Name "%%project%% - Win32 Optimized" +# Name "%%project%% - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;rc" +%%sources%% +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "def;h;hpp;inl" +%%headers%% +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +%%resources%% +# End Group +# Begin Group "Template Files" + +# PROP Default_Filter "template" +%%templates%% +# End Group +# End Target +# End Project +@; + +# --------------------------------------------------------------------- + +$template_console = +q@# Microsoft Developer Studio Project File - Name="%%project%%" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=%%project%% - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak" CFG="%%project%% - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "%%project%% - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "%%project%% - Win32 Optimized" (based on "Win32 (x86) Console Application") +!MESSAGE "%%project%% - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "%%project%%" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W4 /WX /GR /GX %%dbgInfo_r%% /O2 %%includeDirectories_release%% %%defines_release%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 %%libraries_release%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 %%ignoreLibraries_release%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Release\%%project%%_r.exe" /pdbtype:sept %%libraryDirectories_release%% %%incremental_r%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_release%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Optimized" +# PROP BASE Intermediate_Dir "Optimized" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Optimized" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_o%% %%optimizedOptimizations%% /Gf %%includeDirectories_optimized%% %%defines_optimized%% /Yu"%%pch%%" /FD %%zm%% /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_optimized%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 %%ignoreLibraries_optimized%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Optimized\%%project%%_o.exe" /pdbtype:sept %%libraryDirectories_optimized%% %%incremental_o%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_optimized%% + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W4 /WX %%minimalRebuild%% /GR /GX %%dbgInfo_d%% /Od %%debugInline%% %%includeDirectories_debug%% %%defines_debug%% /Yu"%%pch%%" /FD %%zm%% /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 %%libraries_debug%% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 %%ignoreLibraries_debug%% /out:"..\..\..\..\..\..\compile\win32\%%project%%\Debug\%%project%%_d.exe" /pdbtype:sept %%libraryDirectories_debug%% %%incremental_d%% +# SUBTRACT LINK32 /pdb:none +%%specialBuildTool_debug%% + +!ENDIF + +# Begin Target + +# Name "%%project%% - Win32 Release" +# Name "%%project%% - Win32 Optimized" +# Name "%%project%% - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;rc" +%%sources%% +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "def;h;hpp;inl" +%%headers%% +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +%%resources%% +# End Group +# Begin Group "Template Files" + +# PROP Default_Filter "template" +%%templates%% +# End Group +# End Target +# End Project +@; + +# --------------------------------------------------------------------- + +$template_utility = +q@# Microsoft Developer Studio Project File - Name="%%project%%" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Generic Project" 0x010a + +CFG=%%project%% - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "%%project%%.mak" CFG="%%project%% - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "%%project%% - Win32 Release" (based on "Win32 (x86) Generic Project") +!MESSAGE "%%project%% - Win32 Optimized" (based on "Win32 (x86) Generic Project") +!MESSAGE "%%project%% - Win32 Debug" (based on "Win32 (x86) Generic Project") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "%%project%%" +# PROP Scc_LocalPath "..\.." +MTL=midl.exe + +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Release" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Intermediate_Dir "..\..\..\..\..\..\compile\win32\%%project%%\Debug" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "%%project%% - Win32 Release" +# Name "%%project%% - Win32 Optimized" +# Name "%%project%% - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;rc" +%%sources%% +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "def;h;hpp;inl" +%%headers%% +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +%%resources%% +# End Group +# Begin Group "Template Files" + +# PROP Default_Filter "template" +%%templates%% +# End Group +# End Target +# End Project +@; + +# --------------------------------------------------------------------- + +$mocHeader= q@ +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# Begin Custom Build - moc $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Release +InputPath=%%inputPath%% +InputName=%%inputName%% + +"$(TargetDir)\$(InputName).moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc -i $(InputPath) -o $(TargetDir)\$(InputName).moc + +# End Custom Build + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# Begin Custom Build - moc $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Optimized +InputPath=%%inputPath%% +InputName=%%inputName%% + +"$(TargetDir)\$(InputName).moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc -i $(InputPath) -o $(TargetDir)\$(InputName).moc + +# End Custom Build + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# Begin Custom Build - moc $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Debug +InputPath=%%inputPath%% +InputName=%%inputName%% + +"$(TargetDir)\$(InputName).moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc -i $(InputPath) -o $(TargetDir)\$(InputName).moc + +# End Custom Build + +!ENDIF +@; + +# --------------------------------------------------------------------- + +$ui = q@ +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# Begin Custom Build - ui $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Release +InputPath=%%inputPath%% +InputName=%%inputName%% + +BuildCmds= \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName)_r.cpp -impl $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc $(TargetDir)\$(InputName).h >> $(TargetDir)\$(InputName)_r.cpp + +"$(TargetDir)/$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(TargetDir)/$(InputName)_r.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# Begin Custom Build - ui $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Optimized +InputPath=%%inputPath%% +InputName=%%inputName%% + +BuildCmds= \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName)_o.cpp -impl $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc $(TargetDir)\$(InputName).h >> $(TargetDir)\$(InputName)_o.cpp + +"$(TargetDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(TargetDir)\$(InputName)_o.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# Begin Custom Build - ui $(InputName) +TargetDir=..\..\..\..\..\..\compile\win32\%%project%%\Debug +InputPath=%%inputPath%% +InputName=%%inputName%% + +BuildCmds= \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\uic -o $(TargetDir)\$(InputName)_d.cpp -impl $(TargetDir)\$(InputName).h $(InputPath) \ + ..\..\..\..\..\..\external\3rd\library\qt\%%qt_version%%\bin\moc $(TargetDir)\$(InputName).h >> $(TargetDir)\$(InputName)_d.cpp + +"$(TargetDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(TargetDir)\$(InputName)_d.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +@; + +# --------------------------------------------------------------------- + +$release_ui_cpp = q@ +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# ADD CPP /W3 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ENDIF +@; + +$optimized_ui_cpp = q@ +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# ADD CPP /W3 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ENDIF +@; + +$debug_ui_cpp = q@ +!IF "$(CFG)" == "%%project%% - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Optimized" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "%%project%% - Win32 Debug" + +# ADD CPP /W3 +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF +@; + +# --------------------------------------------------------------------- + +$specialBuildTool_release = +q@# Begin Special Build Tool +TargetPath=..\..\..\..\..\..\compile\win32\%%project%%\Release\%%project%%_r.exe +SOURCE="$(InputPath)" +%%preLink_release%% +%%postBuild_release%% +# End Special Build Tool +@; + +$specialBuildTool_optimized = +q@# Begin Special Build Tool +TargetPath=..\..\..\..\..\..\compile\win32\%%project%%\Optimized\%%project%%_o.exe +SOURCE="$(InputPath)" +%%preLink_optimized%% +%%postBuild_optimized%% +# End Special Build Tool +@; + +$specialBuildTool_debug = +q@# Begin Special Build Tool +TargetPath=..\..\..\..\..\..\compile\win32\%%project%%\Debug\%%project%%_d.exe +SOURCE="$(InputPath)" +%%preLink_debug%% +%%postBuild_debug%% +# End Special Build Tool +@; + +$postBuild_release = +q@PostBuild_Desc=Post build steps +PostBuild_Cmds=%%copyDev_release%% +@; + +$postBuild_optimized= +q@PostBuild_Desc=Post build steps +PostBuild_Cmds=%%copyDev_optimized%% +@; + +$postBuild_debug = +q@PostBuild_Desc=Post build steps +PostBuild_Cmds=%%copyDev_debug%% +@; + +$resourceDebugLevels = +q@ +!IF "$(CFG)" == "SwgClient - Win32 Release" + +# ADD BASE RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" +# ADD RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" /d DEBUG_LEVEL=0 + +!ELSEIF "$(CFG)" == "SwgClient - Win32 Optimized" + +# ADD BASE RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" +# ADD RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" /d DEBUG_LEVEL=1 + +!ELSEIF "$(CFG)" == "SwgClient - Win32 Debug" + +# ADD BASE RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" +# ADD RSC /l 0x409 /i "\work\swg\live\src\game\client\application\SwgClient\src\win32" /i "\work\swg\current\src\game\client\application\SwgClient\src\win32" /d DEBUG_LEVEL=2 + +!ENDIF + +@; + +# --------------------------------------------------------------------- + +} diff --git a/tools/BuildEveryDirectoryIncludeHeaderFiles.btm b/tools/BuildEveryDirectoryIncludeHeaderFiles.btm new file mode 100644 index 0000000..9f3e92d --- /dev/null +++ b/tools/BuildEveryDirectoryIncludeHeaderFiles.btm @@ -0,0 +1,11 @@ +cd ..\src\engine\shared\library +call BuildAllDirectoryIncludeHeaderFiles +cd ..\..\..\engine\client\library +call BuildAllDirectoryIncludeHeaderFiles +cd ..\..\..\engine\server\library +call BuildAllDirectoryIncludeHeaderFiles +cd ..\..\..\game\shared\library +call BuildAllDirectoryIncludeHeaderFiles +cd ..\..\..\game\client\library +call BuildAllDirectoryIncludeHeaderFiles +cd ..\..\..\..\tools \ No newline at end of file diff --git a/tools/BuildFunctions.pm b/tools/BuildFunctions.pm new file mode 100644 index 0000000..2fac035 --- /dev/null +++ b/tools/BuildFunctions.pm @@ -0,0 +1,278 @@ +package BuildFunctions; + +require Exporter; + +our @ISA = qw(Exporter); +our @EXPORT = qw(build_project Check_For_Warnings_and_Errors get_time_and_date get_date); + + + +### + # Copyright (C)2000-2002 Sony Online Entertainment Inc. + # All Rights Reserved + # + # Title: BuildFunctions.pl + # Description: This file contains the various functions used by the different build scripts. + # @author $Author: gmcdaniel $ + # @version $Revision: #1 $ + ## + + + + + + +#todo Possible failure points that I need to fix. The ResultsLogfile file can fail to be opened in one sub but still try to be written to in Check_Logfile_For_Warnings_and_Errors +#todo Bad coding to call ResultsLogFile without acutally passing it in to the sub? Probably + + + +## +# This subroutine builds the passed project. It is passed the project name, the string for the project to build, and the project type (release or debug) + +sub build +{ + print ("Beginning $_[1] build...\n"); + system("msdev ..\\src\\build\\win32\\swg.dsw /MAKE \"$_[1]\" /y3 /REBUILD /OUT d:\\buildlogs\\$_[0]_$_[2].log"); + print ("$_[1] build complete\n"); + print ("\n"); + $timestamp = get_time_and_date(); + $timeStamped_Log = $_[0]."_".$_[2]."_".$timestamp.".log"; + system ("copy d:\\buildlogs\\$_[0]_$_[2].log d:\\buildlogs\\$timeStamped_Log"); + print ("\n"); + print ("\n"); + + +} # End of sub build + + + + +## +# This subroutine calls the build subroutine to build both the release and debug versions of the project that is passed + +sub build_project +{ + + $project = $_[0]." - Win32 Release"; + $type = "Release"; + build($_[0],$project,$type); + + + $project = $_[0]." - Win32 Debug"; + $type = "Debug"; + build($_[0],$project,$type); + + + $project = $_[0]." - Win32 Optimized"; + $type = "Optimized"; + build($_[0],$project,$type); + +} # End of sub build_project + + + + +## +# This subroutine returns the current local time and date + +sub get_time_and_date +{ + ($sec, $min, $hour, $day, $month, $year) = (localtime) [0,1,2,3,4,5]; + $month = $month + 1; + $year = $year + 1900; + $dayandtime = $month."_".$day."_".$year."__".$hour."_".$min."_".$sec; + return $dayandtime; + +} # End of sub get_time_and_date + + + + +## +# This subroutine returns the current local date + +sub get_date +{ + ($day, $month, $year) = (localtime) [3,4,5]; + $month = $month + 1; + $year = $year + 1900; + $date = $month."/".$day."/".$year; + return $date; + +} # End of sub get_date + + + + +## +# This subroutine checks for warnings and errors in the build logs. If there is an error it returns true otherwise it returns false. +# It takes the name the logfile to check and the resulting exe or project name as input. + +sub Check_Logfile_For_Warnings_and_Errors +{ + + $third_to_last_line = "test_line_3"; + $second_to_last_line = "test_line_2"; + + open (Logfile,"d:\\buildlogs\\$_[0]") || die "Cannot open $_[0] for reading."; + while () + { + chomp; + $third_to_last_line = $second_to_last_line; + $second_to_last_line = $_; + } + close (Logfile) || die "can't close $_[0]"; + print ("\n"); + print ("$third_to_last_line\n"); + print ("$second_to_last_line\n"); + print ResultsLogfile ("$third_to_last_line\n"); + print ResultsLogfile ("$second_to_last_line\n"); + print ResultsLogfile ("\n"); + + + + + $search_for_errors= "0 error"; + $search_for_warnings= "0 warning"; + $match=-1; + + #check for 0 errors. + if (index($third_to_last_line, $search_for_errors,$match) > -1) { + print ("No errors Found in $_[0]\n"); + print ("\n"); + + #check for warnings + if (index($third_to_last_line, $search_for_warnings,$match) > -1) { + #no warnings or errors found + print ("No Warnings Found in $_[0]\n"); + print ("\n"); + return "false"; + } + #a warning was found + print ("Warning Found in $_[0]\n"); + print ("\n"); + return "true"; + } + + #an error was found + else { + print ("Error Found in $_[0]\n"); + print ("\n"); + return "true"; + } + + +} # End of sub Check_Logfile_For_Warnings_and_Errors + + + + +## +# This subroutine checks for warnings and errors in the build logs. If there is an error or warning it notifies QA and the lead programmers. +# If there is not an error or warning then the build log is just sent to QA. +# It takes the name of the project and the resulting exe or project name as input. + +sub Check_For_Warnings_and_Errors +{ + + print ("Checking for errors and warnings...\n"); + print ("\n"); + + # create file to store warnings and errors for inclusion in body of email. + open (ResultsLogfile, ">d:\\buildlogs\\$_[0]Results.log") || die "Sorry, I couldn't create $_[0]Results.log"; + + + + # Prints to results file for easier email formatting + print ResultsLogfile ("\n"); + print ResultsLogfile ("Release Build:\n"); + + + # Checks for errors or warnings in the release build + $Logfile_to_check = $_[0]."_Release.log"; + $ReleaseError = Check_Logfile_For_Warnings_and_Errors($Logfile_to_check); + + + # Prints to results file for easier email formatting + print ResultsLogfile ("\n"); + print ResultsLogfile ("Debug Build:\n"); + + + # Checks for errors or warnings in the debug build + $Logfile_to_check = $_[0]."_Debug.log"; + $DebugError = Check_Logfile_For_Warnings_and_Errors($Logfile_to_check); + + + + # Prints to results file for easier email formatting + print ResultsLogfile ("\n"); + print ResultsLogfile ("Optimized Build:\n"); + + + # Checks for errors or warnings in the debug build + $Logfile_to_check = $_[0]."_Optimized.log"; + $OptimizedError = Check_Logfile_For_Warnings_and_Errors($Logfile_to_check); + + + # Closes file used for the number of errors and warnings + close (ResultsLogfile); + + + + + + # Email addresses + $gmcdaniel = "gmcdaniel\@soe.sony.com"; + $jbrack = "jbrack\@soe.sony.com"; + $jgrills = "jgrills\@soe.sony.com"; + $asommers = "asommers\@soe.sony.com"; + $cmayer = "cmayer\@soe.sony.com"; + $prog_leads = "-to:$gmcdaniel -to:$jgrills -to:$cmayer -to:$asommers -cc:$jbrack"; + + + + $date_stamp = get_date(); + + if ($ReleaseError eq "true") + { + print ("Error or warning found in $_[0] Release Log. Emailing appropriate people.\n"); + + # Email the results to Programmer Leads and QA + system ("postie -host:sdt-mx1.station.sony.com $prog_leads -from:$gmcdaniel -s:\"[BUILDLOG] Errors or Warnings in Daily $_[0] Build Logs $date_stamp\" -nomsg -file:d:\\buildlogs\\$_[0]Results.log -a:d:\\buildlogs\\$_[0]_Release.log -a:d:\\buildlogs\\$_[0]_Debug.log -a:d:\\buildlogs\\$_[0]_Optimized.log"); + } + + elsif ($DebugError eq "true") + { + print ("Error or warning found in $_[0] Debug Log. Emailing appropriate people.\n"); + + # Email the results to Programmer Leads and QA + system ("postie -host:sdt-mx1.station.sony.com $prog_leads -from:$gmcdaniel -s:\"[BUILDLOG] Errors or Warnings in Daily $_[0] Build Logs $date_stamp\" -nomsg -file:d:\\buildlogs\\$_[0]Results.log -a:d:\\buildlogs\\$_[0]_Release.log -a:d:\\buildlogs\\$_[0]_Debug.log -a:d:\\buildlogs\\$_[0]_Optimized.log"); + } + + elsif ($OptimizedError eq "true") + { + print ("Error or warning found in $_[0] Optimized Log. Emailing appropriate people.\n"); + + # Email the results to Programmer Leads and QA + system ("postie -host:sdt-mx1.station.sony.com $prog_leads -from:$gmcdaniel -s:\"[BUILDLOG] Errors or Warnings in Daily $_[0] Build Logs $date_stamp\" -nomsg -file:d:\\buildlogs\\$_[0]Results.log -a:d:\\buildlogs\\$_[0]_Release.log -a:d:\\buildlogs\\$_[0]_Debug.log -a:d:\\buildlogs\\$_[0]_Optimized.log"); + } + + else + { + print ("No errors or warnings found in $_[0] logs."); + + # Email the results to QA and Programmer Leads + system ("postie -host:sdt-mx1.station.sony.com $prog_leads -from:$gmcdaniel -s:\"[BUILDLOG] $_[0] Build Successful $date_stamp\" -nomsg -file:d:\\buildlogs\\$_[0]Results.log"); + } + + + + print ("End of errors and warning check for $_[0] logs.\n"); + print ("\n"); + + +} # End of sub Check_For_Warnings_and_Errors + + +1; diff --git a/tools/BuildIncludeHeaderFiles.btm b/tools/BuildIncludeHeaderFiles.btm new file mode 100644 index 0000000..62d0a5e --- /dev/null +++ b/tools/BuildIncludeHeaderFiles.btm @@ -0,0 +1,76 @@ +@echo off + +set includesub=%@word["\",-0,%@lfn[.]] + +if NOT ISDIR include mkdir include +if NOT ISDIR include\public mkdir include\public +if NOT ISDIR include\private mkdir include\private +if NOT ISDIR include\public\%includesub mkdir include\public\%includesub +if NOT ISDIR include\private\%includesub mkdir include\private\%includesub +del /e /y /q include\public\%includesub +del /e /y /q include\private\%includesub + +dir /sbfa:-d src\shared\*.h src\shared\*.def > shared.txt +for %header in (@shared.txt) gosub header + +dir /sbfa:-d src\win32\*.h src\win32\*.def > win32.txt +for %header in (@win32.txt) gosub win32 + +dir /sbfa:-d src\linux\*.h src\linux\*.def > linux.txt +for %header in (@linux.txt) gosub linux + +dir /sbfa:-a-d include\public\%dirname > platform.txt +dir /sbfa:-a-d include\private\%dirname >> platform.txt +for %header in (@platform.txt) gosub platform + +del /q shared.txt +del /q win32.txt +del /q linux.txt +del /q platform.txt + +quit 0 + +:setup +set filename=include\%export\%includesub\%@filename[%header] +set relative=%@replace[%@lfn[.]\,..\..\,%header] +set relative=%@replace[\,/,%relative] +return + +:header +gosub export +gosub setup +echo #include "%relative" >> %filename +return + +:win32 +gosub export +gosub setup +echo #if defined(PLATFORM_WIN32) >> %filename +echo #include "%relative" >> %filename +attrib /q -a %filename +return + +:linux +gosub export +gosub setup +set iftest=if +if EXIST %filename set iftest=elif +echo #%iftest defined(PLATFORM_LINUX) >> %filename +echo #include "%relative" >> %filename +attrib /q -a %filename +return + +:platform +echo #else >> %header +echo #error unsupported platform >> %header +echo #endif >> %header +attrib /q +a %header +return + +:export +set export=public +set exportHandle=%@fileopen[%header, read, t] +set exportRead="%@fileread[%exportHandle]" +if %@index[%exportRead,PRIVATE] != -1 set export=private +set exportClose=%@fileclose[%exportHandle] +return diff --git a/tools/BuildInternalPatcherVersion.btm b/tools/BuildInternalPatcherVersion.btm new file mode 100644 index 0000000..793c115 --- /dev/null +++ b/tools/BuildInternalPatcherVersion.btm @@ -0,0 +1,50 @@ +@echo off +if not exist "SwgClient_r.exe" goto error +set dd=%_date +set dn=patcher_20%@instr[6,2,%dd]%@instr[0,2,%dd]%@instr[3,2,%dd]internal + +inkey Press ESC to abort creating patcher version %dn: %%key +if "%@ascii[%key]" == "27" goto :end + + +md \%dn + +copy /u h:\gmcdaniel\public\patch_stuff\patch_trees\*.tre \%dn + +copy /u SwgClient_r.exe \%dn +copy /u SwgClient_r.pdb \%dn +copy /u SwgClient_o.exe \%dn +copy /u SwgClient_o.pdb \%dn +copy /u SwgClientSetup_r.exe \%dn +copy /u dpvs.dll \%dn +copy /u dpvsd.dll \%dn +copy /u gl04_r.dll \%dn +copy /u gl04_o.dll \%dn +copy /u dbghelp.dll \%dn +copy /u DllExport.dll \%dn +copy /u template_patcher_client.cfg \%dn\client.cfg +copy /u locations.txt \%dn +copy /u mss32.dll \%dn +md \%dn\miles +copy /u miles\*.* \%dn\miles\ + + + +goto end + +:error +echo You must run this from the exe\win32 directory! +goto end + + + + + +pushd /%dn +del \\sdlux2\projects\pc\patch\starwars\game\*.tre +copy /u *.* \\sdlux2\projects\pc\patch\starwars\game +popd +popd +start http://laser:7000 +pause +:end diff --git a/tools/BuildLivePatchTreeFromChangelists.pl b/tools/BuildLivePatchTreeFromChangelists.pl new file mode 100755 index 0000000..40fcda9 --- /dev/null +++ b/tools/BuildLivePatchTreeFromChangelists.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +sub numerically +{ + $a <=> $b; +} + +# check command line arguments +if (@ARGV < 2 || ($ARGV[0] =~ /^[-\/]/) || !($ARGV[0] =~ /tre$/i)) +{ + die "usage: $0 [treefile.tre] [changelist ...]\n"; +} + +my $tre = shift; + +# process all changelists gathering up files for the TRE +print "Processing changelists\n"; +my %file; +foreach my $changelist (sort numerically @ARGV) +{ + print "\t$changelist\n"; + open(P4, "p4 describe -s $changelist |"); + while () + { + chomp; + if (s%^\.\.\. //depot/swg/live/(data/sku.\d+/sys.(client|shared)/[^\/]+/[^\/]+)/%%) + { + my $prefix = $1; + s/#\d+ .*//; + $file{$_} = "../../$prefix/" . $_; + + } + } + close(P4); +} +print"\n"; + +# generate the tree file response file +print "Generating response file\n"; +my $rsp = $tre; +$rsp =~ s/tre$/rsp/i; +open(RSP, ">" . $rsp); +foreach (sort keys %file) +{ + print "\t", $_, " @ ", $file{$_}, "\n"; + print RSP $_, " @ ", $file{$_}, "\n"; +} +close(RSP); +print"\n"; + +# build the tree file +print "Generating tree file\n"; +open(TRE, "TreeFileBuilder -r $rsp $tre |"); +print "\t", $_ while (); +close(TRE); +print "\n"; + +# generate the md5sum for the file +print "Generating md5sum\n"; +my $md5 = $tre; +$md5 =~ s/tre$/md5/i; +system("md5sum -b $tre > $md5"); +open(MD5, $md5); +print "\t", $_ while (); +close(MD5); diff --git a/tools/BuildPatcherVersion.btm b/tools/BuildPatcherVersion.btm new file mode 100644 index 0000000..72cc535 --- /dev/null +++ b/tools/BuildPatcherVersion.btm @@ -0,0 +1,59 @@ +@echo off +if not exist "SwgClient_r.exe" goto error +set dd=%_date +set dn=patcher_20%@instr[6,2,%dd]%@instr[0,2,%dd]%@instr[3,2,%dd]internal + +inkey Press ESC to abort creating patcher version %dn: %%key +if "%@ascii[%key]" == "27" goto :end + + +md \%dn + + +del data_compressed_appearance.rsp +del data_compressed_shader.rsp +del data_compressed_other.rsp +del data_uncompressed.rsp +..\..\tools\TreeFileRspBuilder common.cfg +..\..\tools\TreeFileBuilder -r data_compressed_appearance.rsp \%dn\data_compressed_appearance.tre +..\..\tools\TreeFileBuilder -r data_compressed_shader.rsp \%dn\data_compressed_shader.tre +..\..\tools\TreeFileBuilder -r data_compressed_other.rsp \%dn\data_compressed_other.tre +..\..\tools\TreeFileBuilder -r data_uncompressed.rsp \%dn\data_uncompressed.tre + +copy /u SwgClient_r.exe \%dn +copy /u SwgClient_r.pdb \%dn +copy /u SwgClient_o.exe \%dn +copy /u SwgClient_o.pdb \%dn +copy /u SwgClientSetup_r.exe \%dn +copy /u dpvs.dll \%dn +copy /u dpvsd.dll \%dn +copy /u gl04_r.dll \%dn +copy /u gl04_o.dll \%dn +copy /u dbghelp.dll \%dn +copy /u DllExport.dll \%dn +copy /u template_patcher_client.cfg \%dn\client.cfg +copy /u locations.txt \%dn +copy /u mss32.dll \%dn +md \%dn\miles +copy /u miles\*.* \%dn\miles\ + + + +goto end + +:error +echo You must run this from the exe\win32 directory! +goto end + + + + + +pushd /%dn +del \\sdlux2\projects\pc\patch\starwars\game\*.tre +copy /u *.* \\sdlux2\projects\pc\patch\starwars\game +popd +popd +start http://laser:7000 +pause +:end diff --git a/tools/BuildTreeFileVersion.btm b/tools/BuildTreeFileVersion.btm new file mode 100644 index 0000000..9bb1724 --- /dev/null +++ b/tools/BuildTreeFileVersion.btm @@ -0,0 +1,56 @@ +@echo off +if not exist "common.cfg" goto error1 +if "%1" == "" goto error2 + +timer + +set dn=patcher_%1 + +inkey Press ESC to abort creating patcher version %dn: %%key +if "%@ascii[%key]" == "27" goto :end + +md \%dn + +if "%2" == "-t" gosub buildtrees +copy /u ..\..\src\compile\win32\SwgClient\Release\SwgClient_r.exe \%dn +copy /u ..\..\src\compile\win32\SwgClient\Release\SwgClient_r.pdb \%dn +copy /u ..\..\src\compile\win32\SwgClient\Optimized\SwgClient_o.exe \%dn +copy /u ..\..\src\compile\win32\SwgClient\Optimized\SwgClient_o.pdb \%dn +copy /u ..\..\src\compile\win32\SwgClientSetup\Release\SwgClientSetup_r.exe \%dn +copy /u ..\..\dev\win32\*.dll \%dn +copy /u template_patcher_client.cfg \%dn\client.cfg +copy /u locations.txt \%dn +copy /u mss32.dll \%dn +md \%dn\miles +copy /u miles\*.* \%dn\miles\ + +timer + +goto end + +:buildtrees +del data_compressed_animation.rsp +del data_compressed_mesh_skeletal.rsp +del data_compressed_mesh_static.rsp +del data_compressed_other.rsp +del data_compressed_texture.rsp +del data_uncompressed_music.rsp +del data_uncompressed_sample.rsp +..\..\tools\TreeFileRspBuilder common.cfg +..\..\tools\TreeFileBuilder -r data_compressed_animation.rsp \%dn\data_compressed_animation.tre +..\..\tools\TreeFileBuilder -r data_compressed_mesh_skeletal.rsp \%dn\data_compressed_mesh_skeletal.tre +..\..\tools\TreeFileBuilder -r data_compressed_mesh_static.rsp \%dn\data_compressed_mesh_static.tre +..\..\tools\TreeFileBuilder -r data_compressed_other.rsp \%dn\data_compressed_other.tre +..\..\tools\TreeFileBuilder -r data_compressed_texture.rsp \%dn\data_compressed_texture.tre +..\..\tools\TreeFileBuilder -r data_uncompressed_music.rsp -f \%dn\data_uncompressed_music.tre +..\..\tools\TreeFileBuilder -r data_uncompressed_sample.rsp -f \%dn\data_uncompressed_sample.tre +return + +:error1 +echo You must run this from the exe\win32 directory! +goto end + +:error2 +echo Usage: BuildTreeFileVersion changelist [-t (build tree files)] + +:end diff --git a/tools/BuildVcproj.pl b/tools/BuildVcproj.pl new file mode 100755 index 0000000..2b6aca2 --- /dev/null +++ b/tools/BuildVcproj.pl @@ -0,0 +1,2553 @@ +#!/usr/bin/perl +# ===================================================================== + +# figure out what project file we're building +$project = $ARGV[0]; +die "no project name specified" if (!defined($project)); + +# lop off the directories +$project =~ s#^.*[/\\]##; + +# lop off the extension +$project =~ s#\.vcproj$##; + +# capitalize the first letter of the string +$Project = $project; +substr($Project,0,1) =~ tr/a-z/A-Z/; + +# get the directory path, paths need to be relative to the project files +$directory = $ARGV[0]; +if ($directory =~ s#[/\\][^/\\]+$## != 0) +{ + chdir($directory) || die "could not change into directory ". $directory; +} + +# ===================================================================== + +# setup defaults +@defines_debug = ("WIN32", "_DEBUG", "_MBCS", "DEBUG_LEVEL=2", "_CRT_SECURE_NO_DEPRECATE=1", "_USE_32BIT_TIME_T=1"); +@defines_optimized = ("WIN32", "_DEBUG", "_MBCS", "DEBUG_LEVEL=1", "_CRT_SECURE_NO_DEPRECATE=1", "_USE_32BIT_TIME_T=1"); +@defines_release = ("WIN32", "NDEBUG", "_MBCS", "DEBUG_LEVEL=0", "_CRT_SECURE_NO_DEPRECATE=1", "_USE_32BIT_TIME_T=1"); + +$opt_optimizationLevel = "3"; +$opt_intrinsicFunctions = "TRUE"; +$opt_sizeOrSpeed = "1"; + +$fixMfc = 0; +$fixQt = 0; + +$dbgInfo_d = makeDebugInfoFlag("pdb"); +$dbgInfo_o = makeDebugInfoFlag("pdb"); +$dbgInfo_r = makeDebugInfoFlag("pdb"); +$incremental_d = makeIncrementalLinkFlag("yes"); +$incremental_o = makeIncrementalLinkFlag("yes"); +$incremental_r = makeIncrementalLinkFlag("no"); +$minimalRebuild = "TRUE"; +$debugInline = "0"; + +# ===================================================================== +# process RSP files + +open(RSP, "settings.rsp") || die "could not open settings.rsp for " . $project . ", "; +while () +{ + # handle comments + s/#.*//; + + foreach (split) + { + if ($_ eq "windows") + { + $output = $template_windows; + push(@defines_debug, "_WINDOWS"); + push(@defines_optimized, "_WINDOWS"); + push(@defines_release, "_WINDOWS"); + } + elsif ($_ eq "mfc") + { + $output = $template_mfc; + push(@defines_debug, "_WINDOWS"); + push(@defines_optimized, "_WINDOWS"); + push(@defines_release, "_WINDOWS"); + + # Don't fix mfc paths. We want to compile using mfc, not atlmfc + # $fixMfc = 1; + } + elsif ($_ eq "qt334" || $_ eq "qt") + { + $output = $template_qt; + push(@defines_debug, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + push(@defines_optimized, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + push(@defines_release, "_WINDOWS", "QT_DLL", "QT_NO_STL", "QT_ACCESSIBILITY_SUPPORT"); + $qt_version = "3.3.4"; + $fixQt = 1; + } + elsif ($_ eq "console") + { + $output = $template_console; + push(@defines_debug, "_CONSOLE"); + push(@defines_optimized, "_CONSOLE"); + push(@defines_release, "_CONSOLE"); + } + elsif ($_ eq "library") + { + $output = $template_library; + + push(@defines_debug, "_LIB"); + push(@defines_optimized, "_LIB"); + push(@defines_release, "_LIB"); + } + elsif ($_ eq "utility") + { + $output = $template_utility; + } + elsif ($_ eq "noPchDirectory") + { + $noPchDir = 1; + } + elsif ($_ eq "stdafx") + { + $stdafx = 1; + } + elsif ($_ eq "noPch") + { + $noPch = 1; + } + elsif ($_ eq "p4") + { + push(@defines_debug, "CASE_INSENSITIVE", "OS_NT"); + push(@defines_optimized, "CASE_INSENSITIVE", "OS_NT"); + push(@defines_release, "CASE_INSENSITIVE", "OS_NT"); + } + elsif ($_ eq "unicode") + { + push(@defines_debug, "_UNICODE", "UNICODE"); + push(@defines_optimized, "_UNICODE", "UNICODE"); + push(@defines_release, "_UNICODE", "UNICODE"); + } + elsif (s/^Zm//) + { + $zm = " /Zm" . $_ . " "; + } + elsif (/^dbgInfo_/) + { + print "ignoring $_ directive\n"; + } + #elsif (s/^dbgInfo_d_//) + #{ + # $dbgInfo_d = makeDebugInfoFlag($_); + #} + #elsif (s/^dbgInfo_o_//) + #{ + # $dbgInfo_o = makeDebugInfoFlag($_); + #} + #elsif (s/^dbgInfo_r_//) + #{ + # $dbgInfo_r = makeDebugInfoFlag($_); + #} + elsif (/^incremental_/) + { + print "ignoring $_ directive\n"; + } + #elsif (s/^incremental_d_//) + #{ + # $incremental_d = makeIncrementalLinkFlag($_); + #} + #elsif (s/^incremental_o_//) + #{ + # $incremental_o = makeIncrementalLinkFlag($_); + #} + #elsif (s/^incremental_r_//) + #{ + # $incremental_r = makeIncrementalLinkFlag($_); + #} + elsif (/Gm-/) + { + $minimalRebuild = "FALSE"; + } + elsif ($_ eq "copyDev") + { + $copyDev = 1; + } + elsif ($_ eq "debugInline") + { + $debugInline = "1"; + } + elsif ($_ eq "disableOptimizationsInOpt") + { + $opt_optimizationLevel = "0"; + $opt_intrinsicFunctions = "FALSE"; + $opt_sizeOrSpeed = "0"; + } + elsif ($_ eq "versionNumber") + { + $versionNumber = 1; + } + elsif ($_ eq "versionResource") + { + $versionResource = 1; + } + else + { + die "unknown option ", $_, "\n"; + } + } +} +close(RSP); + +# read in the includes list +push(@defines_debug, process_rsp("defines_d.rsp", "defines.rsp")); +push(@defines_optimized, process_rsp("defines_o.rsp", "defines.rsp")); +push(@defines_release, process_rsp("defines_r.rsp", "defines.rsp")); + +# read in the includes list +@includeDirectories_debug = process_rsp("includePaths_d.rsp", "includePaths.rsp"); +@includeDirectories_optimized = process_rsp("includePaths_o.rsp", "includePaths.rsp"); +@includeDirectories_release = process_rsp("includePaths_r.rsp", "includePaths.rsp"); + +# get in the libraries +@libraries_debug = process_rsp("libraries_d.rsp", "libraries.rsp"); +@libraries_optimized = process_rsp("libraries_o.rsp", "libraries.rsp"); +@libraries_release = process_rsp("libraries_r.rsp", "libraries.rsp"); + +# get the libraries to ignore +@ignoreLibraries_debug = process_rsp("ignoreLibraries_d.rsp", "ignoreLibraries.rsp"); +@ignoreLibraries_optimized = process_rsp("ignoreLibraries_o.rsp", "ignoreLibraries.rsp"); +@ignoreLibraries_release = process_rsp("ignoreLibraries_r.rsp", "ignoreLibraries.rsp"); + +# get the libraries search directory paths +@libraryDirectories_debug = process_rsp("libraryPaths_d.rsp", "libraryPaths.rsp"); +@libraryDirectories_optimized = process_rsp("libraryPaths_o.rsp", "libraryPaths.rsp"); +@libraryDirectories_release = process_rsp("libraryPaths_r.rsp", "libraryPaths.rsp"); + +if ($fixMfc) +{ + fixup_mfc_path(@includeDirectories_debug); + fixup_mfc_path(@includeDirectories_optimized); + fixup_mfc_path(@includeDirectories_release); + fixup_mfc_path(@libraryDirectories_debug); + fixup_mfc_path(@libraryDirectories_optimized); + fixup_mfc_path(@libraryDirectories_release); +} + + +if ($fixQt) +{ + fixup_qt_path(@includeDirectories_debug); + fixup_qt_path(@includeDirectories_optimized); + fixup_qt_path(@includeDirectories_release); + fixup_qt_path(@libraryDirectories_debug); + fixup_qt_path(@libraryDirectories_optimized); + fixup_qt_path(@libraryDirectories_release); + + fixup_qt_lib(@libraries_debug); + fixup_qt_lib(@libraries_optimized); + fixup_qt_lib(@libraries_release); +} + + +# ===================================================================== +# scan the current vcproj looking for per-file settings to preserve + +if (open(VCPROJ, $project . ".vcproj")) +{ + while () + { + # remember the guid + if (/ProjectGUID/) + { + chomp; + s/^.*{//; + s/}.*$//; + + $guid = $_; + } + + # eat a > line + if ($state == 2) + { + if (/^\t+>$/) + { + s/^.*$//; + chomp; + } + $state = 3; + } + # look for per-file settings to preserve + if ($state == 3) + { + if (/\/File>/) + { + $state = 0; + } + else + { + $settings{$filename} .= $_; + } + } + if ($state == 1 && /^\t+RelativePath=/) + { + chomp; + s/^[^"]+"//; + s/"[^"]*$//; + $filename = $_; + $state = 2; + } + if (/^\t\t\t; + close(P4); + ($where_depot, $where_client, $where_local) = split; + + # couldn't find it, so make a new guids + open(GUID, $where_local . "|"); + $guid = ; + chomp $guid; + close(GUID); +} +$guid = uc $guid; + +# override the custom build steps for headers that need moc'ed +open(RSP, "mocHeaders.rsp"); +while () +{ + chomp; + + # handle comments + s/#.*//; + + # clean up the input + s/^\s+//; + s/\s+$//; + s#/#\\#g; + + if ($_ ne "") + { + # get just the file name + $name = $_; + $name =~ s#^.*\\##; + $name =~ s#\..*$##; + + $settings{$_} = $mocHeader; + $settings{$_} =~ s/%%inputPath%%/$_/g; + $settings{$_} =~ s/%%inputName%%/$name/g; + } +} +close(RSP); + +# ===================================================================== +# + +sub makeIncrementalLinkFlag +{ + my $input = $_[0]; + local $flag = ""; + local $_; + + if ( $input eq "yes" ) + { + $flag = "2"; + } + elsif ( $input eq "no" ) + { + $flag = "1"; + } + else + { + die "Unknown setting for incremental_link: $input\n"; + } + + return $flag; +} + +# ===================================================================== +# + +sub makeDebugInfoFlag +{ + my $input = $_[0]; + local $flag = ""; + local $_; + + if ( $input eq "line_numbers_only" ) + { + $flag = "2"; + } + elsif ( $input eq "pdb" ) + { + $flag = "3"; + } + elsif ( $input eq "edit_and_continue" ) + { + $flag = "4"; + } + elsif ( $input eq "none" ) + { + $flag = "0"; + } + else + { + die "Unknown setting for dbgInfo: $input\n"; + } + + return $flag; +} + + +sub fixup_mfc_path +{ + foreach (@_) + { + s/library\\mfc/library\\atlmfc/; + } +} + +sub fixup_qt_path +{ + foreach (@_) + { + s/qt\\[0-9]\.[0-9]\.[0-9]/qt\\$qt_version/; + } +} + +sub fixup_qt_lib +{ + my $qtlibver = $qt_version; + $qtlibver =~ s/\.//g; + + foreach (@_) + { + s/qt-mt[0-9][0-9][0-9]/qt-mt$qtlibver/; + } +} + + +# ===================================================================== +# find all the non-linux source files + +sub addfile +{ + my $pathed = $_[0]; + local $_ = $pathed; + + # lop off the directories + s#.*/##; + s#.*\\##; + + if (/\.cpp$/) + { + $sourceNames{$_} = $pathed; + } + elsif (/\.h$/) + { + $headerNames{$_} = $pathed; + } + elsif (/\.def$/) + { + $headerNames{$_} = $pathed; + $settings{$pathed} = $excludeFromBuild; + } + elsif (/\.ui$/) + { + $uiNames{$_} = $pathed; + + $settings{$pathed} = $ui; + $settings{$pathed} =~ s/%%inputPath%%/$pathed/g; + $noExt = $_; + $noExt =~ s/\.ui$//; + $settings{$pathed} =~ s/%%inputName%%/$noExt/g; + } + elsif (/\.template$/) + { + $templateNames{$_} = $pathed; + } + elsif (/\.rc$/) + { + $resourceNames{$_} = $pathed; + $settings{$pathed} = $resourceDebugLevels if ($versionResource); + } + elsif (/\.ico$/ || /\.cur$/ || /\.bmp$/) + { + $resourceNames{$_} = $pathed; + } +} + +sub dodir +{ + local $_; + my $dir = $_[0]; + + opendir(DIR, $dir) || return; + my @filenames = readdir(DIR); + closedir(DIR); + + for (@filenames) + { + next if $_ eq "."; + next if $_ eq ".."; + + $pathed = $dir . "\\" . $_; + + if (-d $pathed) + { + next if ($_ eq "linux"); + next if ($_ eq "solaris"); + &dodir($pathed); + } + else + { + &addfile($pathed); + } + } +} +&dodir("..\\..\\src"); +&dodir("..\\..\\src_oci"); +&dodir("..\\..\\src_odbc"); +&dodir("..\\..\\ui"); + +# get any additional files to include in the build +open(RSP, "additionalFiles.rsp"); +while () +{ + # handle comments + s/#.*//; + + chomp; + s/\s+$//; + &addfile($_) if ($_ ne ""); +} +close(RSP); + +# ===================================================================== +# process all the source files + +# Make sure all First*.cpp projects build the PCH +$settings{$sourceNames{"First$Project.cpp"}} = $createPrecompiledHeader; + +foreach (sort keys %sourceNames) +{ + $_ = $sourceNames{$_}; + $sources .= "\t\t\t\n" . $settings{$_} . "\t\t\t\n"; +} + +foreach (sort keys %headerNames) +{ + $_ = $headerNames{$_}; + $headers .= "\t\t\t\n" . $settings{$_} . "\t\t\t\n"; +} + +foreach (sort keys %resourceNames) +{ + $_ = $resourceNames{$_}; + $resources .= "\t\t\t\n\t\t\t\n"; +} + +foreach (sort keys %uiNames) +{ + # add the ui with the custom build step + $uis .= "\t\t\t + + + + + + + + + + +@; + + $cpp_debug = $_; + $cpp_debug =~ s/\.ui/_d.cpp/; + $cpp_optimized = $_; + $cpp_optimized =~ s/\.ui/_o.cpp/; + $cpp_release = $_; + $cpp_release =~ s/\.ui/_r.cpp/; + $h = $_; + $h =~ s/\.ui/.h/; + + # add the ui-generated files separately for debug, optimized, and release builds + $uiGeneratedSources_debug .= q@ + + + + + + + + + + + +@; + + $uiGeneratedSources_optimized .= q@ + + + + + + + + + + + +@; + + $uiGeneratedSources_release .= q@ + + + + + + + + + + + +@; + + $uiGeneratedHeaders_debug .= q@ + + +@; + + $uiGeneratedHeaders_optimized .= q@ + + +@; + + $uiGeneratedHeaders_release .= q@ + + +@; + +} + +foreach (sort keys %templateNames) +{ + $_ = $templateNames{$_}; + $templates .= "\t\t\t\n" . $settings{$_} . "\t\t\t\n"; +} + +# ===================================================================== +# set up the replacements + +# setup the replacement strings +$replace{"%%guid%%"} = $guid; +$replace{"%%project%%"} = $project; +$replace{"%%Project%%"} = $Project; +$replace{"%%sources%%"} = $sources; +$replace{"%%headers%%"} = $headers; +$replace{"%%resource%%"} = $template_resource; +$replace{"%%resources%%"} = $resources; +$replace{"%%template%%"} = $template_template; +$replace{"%%templates%%"} = $templates; + +$replace{"%%debugInline%%"} = $debugInline; +$replace{"%%dbgInfo_r%%"} = $dbgInfo_r; +$replace{"%%dbgInfo_o%%"} = $dbgInfo_o; +$replace{"%%dbgInfo_d%%"} = $dbgInfo_d; +$replace{"%%incremental_r%%"} = $incremental_r; +$replace{"%%incremental_o%%"} = $incremental_o; +$replace{"%%incremental_d%%"} = $incremental_d; +$replace{"%%minimalRebuild%%"} = $minimalRebuild; +$replace{"%%opt_optimizationLevel%%"} = $opt_optimizationLevel; +$replace{"%%opt_intrinsicFunctions%%"} = $opt_intrinsicFunctions; +$replace{"%%opt_sizeOrSpeed%%"} = $opt_sizeOrSpeed; + +$replace{"%%includeDirectories_debug%%"} = explode(",", @includeDirectories_debug); +$replace{"%%includeDirectories_optimized%%"} = explode(",", @includeDirectories_optimized); +$replace{"%%includeDirectories_release%%"} = explode(",", @includeDirectories_release); +$replace{"%%defines_debug%%"} = explode(";", @defines_debug); +$replace{"%%defines_optimized%%"} = explode(";", @defines_optimized); +$replace{"%%defines_release%%"} = explode(";", @defines_release); +$replace{"%%libraries_debug%%"} = explode(" ", @libraries_debug); +$replace{"%%libraries_optimized%%"} = explode(" ", @libraries_optimized); +$replace{"%%libraries_release%%"} = explode(" ", @libraries_release); +$replace{"%%libraryDirectories_debug%%"} = explode(",", @libraryDirectories_debug); +$replace{"%%libraryDirectories_optimized%%"} = explode(",", @libraryDirectories_optimized); +$replace{"%%libraryDirectories_release%%"} = explode(",", @libraryDirectories_release); +$replace{"%%ignoreLibraries_debug%%"} = explode(",", @ignoreLibraries_debug); +$replace{"%%ignoreLibraries_optimized%%"} = explode(",", @ignoreLibraries_optimized); +$replace{"%%ignoreLibraries_release%%"} = explode(",", @ignoreLibraries_release); + +$replace{"%%uis%%"} = $uis; +$replace{"%%uiGeneratedSources_debug%%"} = $uiGeneratedSources_debug; +$replace{"%%uiGeneratedHeaders_debug%%"} = $uiGeneratedHeaders_debug; +$replace{"%%uiGeneratedSources_optimized%%"} = $uiGeneratedSources_optimized; +$replace{"%%uiGeneratedHeaders_optimized%%"} = $uiGeneratedHeaders_optimized; +$replace{"%%uiGeneratedSources_release%%"} = $uiGeneratedSources_release; +$replace{"%%uiGeneratedHeaders_release%%"} = $uiGeneratedHeaders_release; + +$replace{"%%qt_version%%"} = $qt_version; + +$replace{"%%usepch%%"} = "3"; + +if ($stdafx) +{ + $replace{"%%pch%%"} = "StdAfx.h"; +} +else +{ + if ($noPch) + { + $replace{"%%usepch%%"} = "0"; + $replace{"%%pch%%"} = ""; + } + elsif ($noPchDir) + { + $replace{"%%pch%%"} = "First" . $Project . ".h"; + } + else + { + $replace{"%%pch%%"} = $project . "\\First" . $Project . ".h"; + } +} + +# ===================================================================== + +# do all the replacements repeatedly until no more replacements can be made +do +{ + $changed = 0; + foreach $key (keys %replace) + { + $changed += $output =~ s/$key/$replace{$key}/; + } +} while ($changed > 0); + +# remove all blank lines +$output =~ s/^\n+//; +$output =~ s/\n\n+/\n/g; + +# convert newlines to cr/lf sequences +$output =~ s/\n/\cM\cJ/g; + +# save the output +open(DSP, ">" . $project . ".vcproj") || die "could not open project file " . $project . ".vcproj for writing\n"; +binmode(DSP); +print DSP $output; +close(DSP); + +# ===================================================================== + +BEGIN +{ + +sub process_rsp +{ + local $_; + my @rsp; + while (@_) + { + open(RSP, shift @_); + while () + { + chomp; + + # handle comments + s/#.*//; + + s/\s+$//; + tr/\//\\/; + push(@rsp, $_) if ($_ ne ""); + } + close(RSP); + } + return @rsp; +} + +sub explode +{ + local $_; + my $separator = shift @_; + my $result = shift @_; + + foreach (@_) + { + $result .= $separator . $_; + } + + return $result; +} + +# --------------------------------------------------------------------- + +$template_windows = q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + +%%template%% +%%resource%% + + + + +@; + +$template_mfc = q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + +%%template%% +%%resource%% + + + + +@; + +$template_qt= q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + + +%%uis%% + + + + +%%uiGeneratedSources_debug%% + + +%%uiGeneratedHeaders_debug%% + + + + +%%uiGeneratedSources_optimized%% + + +%%uiGeneratedHeaders_optimized%% + + + + +%%uiGeneratedSources_release%% + + +%%uiGeneratedHeaders_release%% + + + +%%resource%% +%%template%% + + + + +@; + +$template_console = q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + +%%template%% + + + + +@; + +$template_library = q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + +%%template%% + + + + +@; + +$template_utility = q@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%%sources%% + + +%%headers%% + +%%template%% +%%resource%% + + + + +@; + + $template_resource = q@ + +%%resources%% + +@; + + $template_template = q@ + +%%templates%% + +@; + + $mocHeader = q@ + + + + + + + + + +@; + + $excludeFromBuild = q@ + + + + + + + + + +@; + + $createPrecompiledHeader = q@ + + + + + + + + + +@; + +# --------------------------------------------------------------------- + +} diff --git a/tools/CheckPatchTreeSize.pl b/tools/CheckPatchTreeSize.pl new file mode 100755 index 0000000..9e1441a --- /dev/null +++ b/tools/CheckPatchTreeSize.pl @@ -0,0 +1,240 @@ +#! /usr/bin/perl +# ====================================================================== +# ====================================================================== + +use strict; +use warnings; +use File::Copy; + +# ====================================================================== +# Globals +# ====================================================================== + +my $oldManifest = "dailyPatchSizeOld.mft"; +my $newManifest = "dailyPatchSizeNew.mft"; +my $tabFile = "CheckPatchTreeSize.tab"; +my $numberOfTabOuts = 15; +my $p4 = "p4"; + +my $branch; +my $changelist; +my $toolsDir; +my %patchTreeSizes; + +my $name = $0; +$name =~ s/^(.*)\\//; +my $logfile = $name; +$logfile =~ s/\.pl$/\.log/; + +# ====================================================================== +# Subroutines +# ====================================================================== + +sub getP4dir +{ + my $path = $_[0]; + + open(P4, "p4 where ${path}... |"); + my $perforceDir; + while() + { + $perforceDir = $_; + } + my @temp = split /\s+/, $perforceDir; + my $retDir = $temp[2]; + close(P4); + + $retDir =~ s/\.\.\.//g; + + return $retDir; +} + +sub usage +{ + die "\n\t$name []\n\n"; +} + +sub readMft +{ + my ($filename, $hashRef) = @_; + + return if (!-e $filename); + + open(MFT, $filename); + + my $version = ; + chomp $version; + $version =~ s/ .*//; + die "unsupported manifest version" if ($version ne "version2"); + + while() + { + my ($archive, $action, $uncsize, $cmpsize, $checksum, $depotfile, $file) = /^(\S+)\t\S+\t(\S+)\t\S+\t(\S+)\t(\S+)\t(\S+)\t(\S+)\#\d+\t(\S+)\n$/; + next if(!defined $file); + $$hashRef{$depotfile} = [$checksum, $file, $archive, $action, $uncsize, $cmpsize]; + } + close(MFT); +} + +sub doSync +{ + my $oldchangelist = -1; + + open(TABFILE, $tabFile) || goto NOTABFILE; + while() + { + $oldchangelist = $1 if(/(\d+)\n/); + } + close(TABFILE); + +NOTABFILE: + + if($oldchangelist == -1) + { + system("$p4 sync //depot/swg/$branch/data/...\@$changelist //depot/swg/$branch/exe/win32/...\@$changelist > $logfile 2>&1"); + } + else + { + system("$p4 sync //depot/swg/$branch/data/...\@$oldchangelist,$changelist //depot/swg/$branch/exe/win32/...\@$changelist > $logfile 2>&1"); + } +} + +sub doExcelOut +{ + my @tabOuts; + + print "\nTab delimeted output for $branch:\n"; + + my @skus = (sort keys %patchTreeSizes); + print "Time\t"; + foreach (@skus) + { + print "sku.$_\t"; + } + print "Changelist\n"; + + if (-e $tabFile) + { + open(TABFILE, $tabFile); + while() + { + push @tabOuts, $_; + } + close(TABFILE); + } + + while(@tabOuts > $numberOfTabOuts) + { + shift @tabOuts; + } + + foreach (@tabOuts) + { + print; + } + + my ($sec, $min, $hr, $day, $mon, $yr) = localtime time; + my $timestamp = sprintf "%4s-%02s-%02s %02s:%02s:%02s", ($yr + 1900), ($mon + 1), $day, $hr, $min, $sec; + + my $output = "$timestamp\t"; + foreach (@skus) + { + if(exists $patchTreeSizes{$_}) + { + $output .= "$patchTreeSizes{$_}\t"; + } + else + { + $output .= "0\t"; + } + } + $output .= "$changelist\n"; + + print $output; + open(TABFILE, ">>$tabFile"); + print TABFILE $output; + close(TABFILE); +} + +sub doChanges +{ + my %oldMft; + my %newMft; + my @output; + + # Read in the mft file information + readMft($oldManifest, \%oldMft); + readMft($newManifest, \%newMft); + + # Check for differences + foreach (keys %newMft) + { + # Only update output if the file is new, or the checksum has changed + next if(exists $oldMft{$_} && $newMft{$_}->[0] eq $oldMft{$_}->[0]); + + my $uncDiff = $newMft{$_}->[4] - ((exists $oldMft{$_}) ? $oldMft{$_}->[4] : 0); + my $cmpDiff = $newMft{$_}->[5] - ((exists $oldMft{$_}) ? $oldMft{$_}->[5] : 0); + push @output, join("\t", $_, $newMft{$_}->[1], $newMft{$_}->[2], $newMft{$_}->[3], $uncDiff, $cmpDiff); + } + + print "\nFiles changed for $branch:\n"; + print join("\t", "Depot Name", "File Name", "Archive", "Action", "Size Added (Uncompressed)", "Size Added (Compressed)"), "\n"; + @output = sort { $a cmp $b } @output; + print join "\n", @output; +} + +# ====================================================================== +# Main +# ====================================================================== + +usage() if(@ARGV < 2); + +my $inputManifest = shift; +$branch = shift; + +$changelist = `p4 counter change`; +chomp $changelist; +$changelist = shift if (@ARGV); + +$toolsDir = getP4dir("//depot/swg/current/tools/"); +my $buildClientDataTreeFiles = getP4dir("//depot/swg/all/tools/build/shared/buildClientDataTreeFiles.pl"); + +my $exeDir = getP4dir("//depot/swg/$branch/exe/win32/"); +chdir $exeDir or die "Could not change directory: $!"; +my $pwd = `pwd`; +chomp $pwd; +$ENV{"PWD"} = $pwd; + +doSync(); + +system("perl $buildClientDataTreeFiles --noVerify $newManifest $inputManifest 0 > $logfile"); + +die "Error creating patch tree - patch_0_00.tre does not exist\n" if(!-e "patch_0_00.tre"); + +opendir DH, $exeDir; +foreach (sort readdir DH) +{ + if(/patch_sku([^_]+)_0_(\d+)\.tre/) + { + $patchTreeSizes{$1} = 0 if (!exists $patchTreeSizes{$1}); + $patchTreeSizes{$1} += (-s $_); + } + elsif (/patch_0_(\d+)\.tre/) + { + $patchTreeSizes{0} = 0 if (!exists $patchTreeSizes{0}); + $patchTreeSizes{0} += (-s $_); + } +} +closedir DH; + +print "Patch tree sizes for $branch:\n"; + +foreach (sort keys %patchTreeSizes) +{ + print "Size of sku$_.tre is: ".$patchTreeSizes{$_}."\n"; +} + +doExcelOut(); +doChanges() if(-e $oldManifest); + +move $newManifest, $oldManifest || die "move from $newManifest to $oldManifest failed"; diff --git a/tools/ClientCacheFileBuilder.exe b/tools/ClientCacheFileBuilder.exe new file mode 100644 index 0000000..b41426a Binary files /dev/null and b/tools/ClientCacheFileBuilder.exe differ diff --git a/tools/ContentSync.pl b/tools/ContentSync.pl new file mode 100755 index 0000000..9351fea --- /dev/null +++ b/tools/ContentSync.pl @@ -0,0 +1,195 @@ +#! /usr/bin/perl +# +# Fix for Malformed UTF-8 Character error in perl 5.8.0 on linux - "export LANG=en_US" + +use warnings; +use strict; + +# ====================================================================== +# initialization + +# setup perforce access environment variables +my $p4 = "p4"; + +my $branch = ""; +my $startingChangelist = 0; +my $endingChangelist; +my $contentLevel = 2; + +my $name = $0; +$name =~ s/^(.*)\\//; + +my $logfile = $name; +$logfile =~ s/\.pl$/\.log/; + +my $programmer = 0; +my $designer = 1; +my $artist = 2; +my $default = $programmer; +my %content; + +# ====================================================================== + +sub usage +{ + print STDERR "\nUsage:\n"; + print STDERR "\t$name \n"; + print STDERR "\n\tending changelist can be a changelist or #head\n"; + die "\n"; +} + +sub getUsers +{ + my ($group, $value) = @_; + my $foundUsers = 0; + + open(P4, "$p4 group -o $group |"); + while() + { + $foundUsers = 1 if(/^Users:/); + next if(!$foundUsers); + $content{$1} = $value if(/^\s+(\S+)/); + } + close(P4); +} + +# ====================================================================== + +&usage() if(@ARGV == 0); + +my $forceContentLevel; +if(@ARGV == 4) +{ + $forceContentLevel = shift @ARGV; +} + +&usage() if(@ARGV != 3); + +$branch = shift; +$startingChangelist = shift; +$endingChangelist = shift; + +my $user; + +print "Gathering list of users...\n"; +getUsers("swg_programmers", $programmer); +getUsers("swg_leads", $programmer); +getUsers("swg_qa", $programmer); +getUsers("swg_designers", $designer); +getUsers("swg_artists", $artist); + +if (defined $forceContentLevel) +{ + $contentLevel = $forceContentLevel; + $user = "ContentLevelOverride"; +} +else +{ + open(P4, "$p4 user -o |") || die "p4 user failed\n"; + while() + { + if(/^User:\s+(\S+)/) + { + $user = $1; + die "Could not determine if $user is a programmer, designer, or artist\n" if(!exists $content{$user}); + + $contentLevel = $content{$user}; + } + } + close(P4); +} + +my $level; +die "Unknown contentLevel: $contentLevel\n" if($contentLevel < 0); +$level = "programmer" if($contentLevel == 0); +$level = "designer" if($contentLevel == 1); +$level = "artist" if($contentLevel == 2); +$level = "specified content only" if($contentLevel >= 3); + +print STDERR "Syncing for $user at content level of $level\n"; + +print STDERR "Getting changes from $startingChangelist to $endingChangelist...\n"; +my @changes; +open(P4, "$p4 changes -s submitted //depot/swg/$branch/...\@$startingChangelist,$endingChangelist |") || die "p4 changes failed\n"; +while () +{ + chomp; + s/^Change //; + s/ .*//; + unshift @changes, $_; +} +close(P4); + +print STDERR "Scanning changes...\n"; +# process all the changelists looking for content files +my %sync; +foreach my $changeList (@changes) +{ + # read the change description + my $content = 0; + my $user; + my $notes = ""; + my $file; + open(P4, "$p4 -ztag describe -s $changeList |") || die "die: p4 change failed"; + + while () + { + # make the initial decision based on the user + if (/^\.\.\.\s+user\s+(.*)/) + { + $user = $1; + if (!defined $content{$user}) + { + # If we don't have the user listed, use default + $content = $default >= $contentLevel ? 1 : 0; + print STDERR "could not determine content status of $1 for changelist $changeList\n"; + } + else + { + $content = $content{$user} >= $contentLevel ? 1 : 0; + } + } + + # allow overrides in the descriptions + if (/\[\s*no\s+content\s*\]/i) + { + $content = 0; + $notes = " specified [no content]"; + } + if (/\[\s*content\s*\]/i) + { + $content = 1; + $notes = " specified [content]"; + } + + # remember content files + if ($content) + { + $file = $1 if (/^\.\.\.\s+depotFile\d+\s+(.*)/); + $sync{$file} = $1 if (/^\.\.\.\s+rev\d+\s+(.*)/); + } + } + + # give summary of this changelist + print "no " if (!$content); + print "content $changeList $user$notes\n"; + + close(P4); +} + +if (scalar(keys %sync) != 0) +{ + print STDERR "\nUpdating the client with ", scalar(keys %sync), " file(s)...\n"; + open(P4, "| $p4 -x - sync > $logfile 2>&1"); + foreach (sort keys %sync) + { + print P4 $_, "#", $sync{$_}, "\n"; + } + close(P4); +} +else +{ + print STDERR "No files to update.\n"; +} + +#unlink($logfile); diff --git a/tools/CoreMemWalker b/tools/CoreMemWalker new file mode 100644 index 0000000..dcfb9b7 Binary files /dev/null and b/tools/CoreMemWalker differ diff --git a/tools/CoreMemWalker.cpp b/tools/CoreMemWalker.cpp new file mode 100644 index 0000000..42cf8cd --- /dev/null +++ b/tools/CoreMemWalker.cpp @@ -0,0 +1,177 @@ + +// Compile this with g++ -O6 -o CoreMemWalker CoreMemWalker.cpp -static + +#include +#include +#include +#include +#include +#include +#include + +// ====================================================================== + +struct SystemAllocation +{ + int size; + unsigned int next; + int pad1, pad2; +}; + +struct AllocatedBlock +{ + // Block is 16 for debug build, 12 for release build (release build doesn't have array) + unsigned int prev, next; + bool free:1; +#ifdef _DEBUG + bool array:1; +#endif + bool leakTest:1; + unsigned int size:30; + + // AllocatedBlock starts here + unsigned int owner[64]; +}; + +struct AddressOffset +{ + unsigned int s, e, o; +}; + +// ====================================================================== + +int ao_c = 0; +AddressOffset ao[1024]; +char const *coreMem = 0; +unsigned int coreLen = 0; +const unsigned int MAX_MAP_SIZE = 2000000000; + +// ====================================================================== + +bool mapCore(char const *coreName) +{ + int fd = open(coreName, O_RDONLY); + if (fd != -1) + { + struct stat s; + fstat(fd, &s); + coreLen = s.st_size; + if (coreLen > MAX_MAP_SIZE) + coreLen = MAX_MAP_SIZE; + coreMem = reinterpret_cast(mmap(0, coreLen, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, fd, 0)); + close(fd); + } + return coreMem && coreMem != ((char const *)MAP_FAILED) ? true : false; +} + +// ---------------------------------------------------------------------- + +void unmapCore() +{ + if (coreMem) + munmap(reinterpret_cast(const_cast(coreMem)), coreLen); +} + +// ---------------------------------------------------------------------- + +bool loadMemoryMap(char const *mapName) +{ + FILE *fp = fopen(mapName, "r"); + if (fp) + { + unsigned int a, c, d, e, f; + char b[512], g[512]; + while (fscanf(fp, "%d %s %x %x %x %x %s\n", &a, b, &c, &d, &e, &f, g) == 7) + { + ao[ao_c].s = d; + ao[ao_c].e = d+c; + ao[ao_c].o = f-d; + ++ao_c; + } + fclose(fp); + return true; + } + return false; +} + +// ---------------------------------------------------------------------- + +char const *getMem(unsigned int addr) +{ + for (int i = 0; i < ao_c; ++i) + if (addr >= ao[i].s && addr < ao[i].e) + return coreMem+addr+ao[i].o; + return coreMem; +} + +// ---------------------------------------------------------------------- + +int main(int argc, char **argv) +{ + if (argc != 5) + { + fprintf(stderr, + "Usage: CoreMemWalker coreName mapName firstSystemAllocationAddr ownerCount\n" + " This is only meant to be used from the coreMemReport.sh script.\n"); + + AllocatedBlock a; + fprintf(stderr, "sizeof(AllocatedBlock)=%d, sizeof(AllocatedBlock) - owner=%d\n", sizeof(AllocatedBlock), sizeof(AllocatedBlock) - sizeof(a.owner)); + fprintf(stderr, "&AllocatedBlock=%p, sizeof=%d\n", &a, sizeof(a)); + fprintf(stderr, "&AllocatedBlock.prev=%p, sizeof=%d\n", &a.prev, sizeof(a.prev)); + fprintf(stderr, "&AllocatedBlock.next=%p, sizeof=%d\n", &a.next, sizeof(a.next)); + fprintf(stderr, "&AllocatedBlock.owner=%p, sizeof=%d\n", &a.owner, sizeof(a.owner)); + + return 1; + } + + char const *coreName = argv[1]; + char const *mapName = argv[2]; + unsigned int firstSystemAllocationAddr = atoi(argv[3]); + unsigned int ownerCount = atoi(argv[4]); +// int count = 0; + + if ( mapCore(coreName) + && loadMemoryMap(mapName)) + { + unsigned int systemAllocationAddr = firstSystemAllocationAddr; + while (systemAllocationAddr) + { + SystemAllocation const * const systemAllocation = reinterpret_cast(getMem(systemAllocationAddr)); + AllocatedBlock const * const firstBlockForSA = reinterpret_cast(reinterpret_cast(systemAllocation)+16); + AllocatedBlock const * const lastBlockForSA = reinterpret_cast(reinterpret_cast(systemAllocation)+systemAllocation->size-16); + unsigned int blockAddr = firstBlockForSA->next; + AllocatedBlock const *block = reinterpret_cast(getMem(blockAddr)); + while (block != lastBlockForSA) + { + if (!block->free) + { + printf("0x%x %d", blockAddr, block->size); + for (int i = 0; i < ownerCount; ++i) + printf(" 0x%x", block->owner[i]); + printf("\n"); + +// ++count; +// printf("%d\n", count); + +// if (count > 2153024) +// break; + } + if (blockAddr == block->next) + break; + blockAddr = block->next; + block = reinterpret_cast(getMem(blockAddr)); + } + +// if (count > 2153024) +// break; + + if (systemAllocationAddr == systemAllocation->next) + break; + systemAllocationAddr = systemAllocation->next; + } + unmapCore(); + } + + return 0; +} + diff --git a/tools/CoreMemWalker_debug b/tools/CoreMemWalker_debug new file mode 100644 index 0000000..c6c5f0e Binary files /dev/null and b/tools/CoreMemWalker_debug differ diff --git a/tools/DataLintRspBuilder.exe b/tools/DataLintRspBuilder.exe new file mode 100644 index 0000000..b16acf8 Binary files /dev/null and b/tools/DataLintRspBuilder.exe differ diff --git a/tools/Delta2.exe b/tools/Delta2.exe new file mode 100644 index 0000000..b12185e Binary files /dev/null and b/tools/Delta2.exe differ diff --git a/tools/ExtractProfileInfo b/tools/ExtractProfileInfo new file mode 100644 index 0000000..fa17f48 Binary files /dev/null and b/tools/ExtractProfileInfo differ diff --git a/tools/ExtractProfileInfo.cpp b/tools/ExtractProfileInfo.cpp new file mode 100644 index 0000000..3ff5091 --- /dev/null +++ b/tools/ExtractProfileInfo.cpp @@ -0,0 +1,70 @@ +#include +#include +#include + +int main(int argc, char** argv) +{ + if (argc != 2) + { + printf("syntax: \"%s search_string\"\n", argv[0]); + printf("example: \"%s SwgGameServer:15433 < profile.txt > chilastra_profile_restuss.txt\"\n", argv[0]); + printf("example: \"%s handleFX < profile.txt > handleFX_profile.txt\"\n", argv[0]); + return 0; + } + + char * buffer[32768]; + for (int i = 0; i < 32768; ++i) + buffer[i] = reinterpret_cast(malloc(512)); + + bool found = false; + int bufferIndex = 0; + while (gets(buffer[bufferIndex])) + { + if (strstr(buffer[bufferIndex], argv[1])) + { + found = true; + } + + if (strlen(buffer[bufferIndex]) > 0) + { + ++bufferIndex; + } + else + { + if (found) + { + for (int i = 0; i < bufferIndex; ++i) + { + printf("%s\n", buffer[i]); + } + + printf("\n"); + } + + found = false; + bufferIndex = 0; + } + + if (bufferIndex >= 32768) + { + printf("ERROR! Profile block exceeds 32768 lines\n"); + found = false; + break; + } + } + + if (found) + { + for (int i = 0; i < bufferIndex; ++i) + { + printf("%s\n", buffer[i]); + } + + printf("\n"); + } + + for (int i = 0; i < 32768; ++i) + free(buffer[i]); + + return 0; +} diff --git a/tools/LINT-NT.EXE b/tools/LINT-NT.EXE new file mode 100644 index 0000000..d11e83c Binary files /dev/null and b/tools/LINT-NT.EXE differ diff --git a/tools/LabelHashTool b/tools/LabelHashTool new file mode 100644 index 0000000..160d2c8 Binary files /dev/null and b/tools/LabelHashTool differ diff --git a/tools/LabelHashTool.exe b/tools/LabelHashTool.exe new file mode 100644 index 0000000..b6ab07a Binary files /dev/null and b/tools/LabelHashTool.exe differ diff --git a/tools/MoneyCheckActivity.pl b/tools/MoneyCheckActivity.pl new file mode 100755 index 0000000..43e58f3 --- /dev/null +++ b/tools/MoneyCheckActivity.pl @@ -0,0 +1,363 @@ +#! /usr/bin/perl + +use strict; +use warnings; +use Getopt::Std; +use Math::BigInt; + +my %player_hash; + +# key (player id) => (# trans to, total amt to them, last time to them, +# # trans from, total amt from them, last time from them) +# money_hash is a global hash referece for whatever player we are analyzing +my $money_hash; + +my $cnt = 0; +my $sort_val = 0; +my $max_cnt = 0; +my %args; +my $start_time; +my $min_thresh = 0; +my $max_thresh = 0; +my $player_id = 0; +my $start_date; +my $end_date; +my $num_days; + +my $total_in = new Math::BigInt '0'; +my $total_out = new Math::BigInt '0'; +my $num_total_in = new Math::BigInt '0'; +my $num_total_out = new Math::BigInt '0'; +my @keys; + +my $big_zero = new Math::BigInt '0'; +my $str_out; + +my $abridged = 1; + +# Usage +sub usage +{ + my $name = $0; + $name =~ s/^(.*)\\//; + print STDERR "\nUsage:\n"; + print STDERR "\t$name ... (as many player ids as you want to scan)\n"; + print STDERR "\t\tDate format = yyyy-mm-dd (eg: 2004-06-08)\n"; + print STDERR "\t$name -f ... (as many player ids as you want to scan)\n"; + print STDERR "Optional parameters:\n"; + print STDERR "\t[-l ] [-s | -S ] [-n | -a | -t | -N | -A | -T] [-m | -x | -e ] [-d]\n"; + print STDERR "\t-l \tOnly process lines of log file\n"; + print STDERR "\t-s