[BATCH] Windows Trinity buildscript

Hi there,

last year I wrote a little batch file to automatic all steps of the Trinity Buildprocess (no DB actions!). Here is the new version for Git.

Edit 16.01.2011:

  • Update AuctionHouseBot and Glyphs patch to new structure, again

  • Before patch, delete every not finished/not applieable patch from patch que

Edit 07.01.2011:

  • Update devsnull Patches to new structure

  • Insert find mechanism for Patchnames instead of static filenames

What must be installed to standard folders(to support all in Script included Repos):

  • GitExtensions (Please open the tool manual to setup email, username ect.)

  • TortoiseSVN (Please open the tool manual to setup email, username ect)

  • TortoiseHG (Please open the tool manual to setup email, username ect)

  • cMake

  • OpenSSL32/64Bit (Install binaries to: …\bin)

  • VisualStudio(-Express)

If you used all tools without errors before, you need nothing to change.

The script automatically detect Windows 32/64Bit and set the folders for you.

Please check the settings Block in the script and change it to your environment.



!!! Change the Patch section if you need other patches or no patch !!!

What it does at first startup (if folders do not exist):

  • Generate folders

  • Clone repos

  • Apply patches

  • run cmake (VisualStudio10 32Bit, Release + default settings)

  • Compile with VisualStudio CommandLine

  • Copy OpenSSL DLLs

  • Open Release folder

What it does if folders exist:

  • Reset lokal trinity repo --hard (revert changes by patches)

  • Update all repos

  • Delete every not finished/not applieable patch from patch que

  • Apply patches, again

  • run cmake (VisualStudio10 32Bit, Release + default settings)

  • Delete . in Release folder

  • Compile with VisualStudio CommandLine

  • Copy OpenSSL DLLs

  • Open Release folder

Thats it. No magic, just a little helper.

Copy the code into a textfile and rename it to WhatEverYouLike.bat

[SPOILER]@echo OFF

CLS

REM Visual Studion build configuration: Release (default), MinSizeRel, RelWithDebInfo or Debug

set build=Release

REM Select cMake generator: “Visual Studio 10” (32Bit), “Visual Studio 10 Win64” (64Bit)

set cMake_Generator=“Visual Studio 10”

REM Repos

set repo_trinity=https://github.com/TrinityCore/TrinityCore.git

set repo_patch1=https://github.com/thedevnull/thedevnull-patches.git

set repo_patch2=https://bitbucket.org/lordpsyan/trinitycore-patches

set repo_database=“https://trinitydb.googlecode.com/hg/ trinitydb”

set repo_database_ger=https://gt-db.svn.sourceforge.net/svnroot/gt-db/trunk

REM Folders

set f_sources=D:\TC

set f_build=D:\TC_Builds

set f_patches1=D:\TC_Patches1

set f_patches2=D:\TC_Patches2

set f_database=D:\TC_DB

set f_database_ger=D:\TC_DB_GER

set f_build_release=%f_build%\bin\Release\

REM Checking for 32/64Bit OS

set prog_path=%ProgramFiles%

if not “[%ProgramFiles(x86)%]”==“[]” set prog_path=%ProgramFiles(x86)%

REM Programs

set Git=“%prog_path%\Git\bin\git.exe”

set HG=“%prog_path%\TortoiseHg\hg.exe”

set CMake=“%prog_path%\CMake 2.8\bin\cmake.exe”

REM TortoiseSVN could be exist as 64Bit Program, so path is equal on 32/64Bit Windows

set SVN=“C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe”

REM VisualStudio: If you use the ExpressVersion, insert path to VisualStudio.exe

set VisualStudio=“%prog_path%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe”

REM OpenSSL (installed in …\bin, could be in system32, too)

set OpenSSL_1=“C:\OpenSSL-Win32\bin\libeay32.dll”

set OpenSSL_2=“C:\OpenSSL-Win32\bin\ssleay32.dll”

set OpenSSL_3=“C:\OpenSSL-Win64\bin\libeay64.dll”

set OpenSSL_4=“C:\OpenSSL-Win64\bin\ssleay64.dll”

echo ###############################################################################

echo ### TrinityGit.bat by daddelkopp 10.01.2010 ###

echo ###############################################################################

echo.

echo.

echo 1. Clone/Clean/Pull Repos ###

echo ###############################################################################

echo.

echo ### Clone/Pull thedevnull Patches

echo.

IF not exist %f_patches1% (

echo - Create folder “%f_patches1%”

echo.

md %f_patches1%

call %Git% clone %repo_patch1% %f_patches1%

)ELSE (

cd %f_patches1%

call %Git% pull

)

echo.

echo.

echo ### Clone/Pull lordpsyan Patches

echo.

IF not exist %f_patches2% (

echo - Create folder “%f_patches2%”

echo.

md %f_patches2%

%HG% clone %repo_patch2% %f_patches2%

)ELSE (

cd %f_patches2%

call %HG% pull -u

)

echo.

IF not exist %f_sources% (

echo ### Clone Trinity

echo.

echo - Create folder “%f_sources%”

echo.

md %f_sources%

echo.

call %Git% clone %repo_trinity% %f_sources%

)ELSE (

cd %f_sources%

echo.

echo ### Reverse formally applied Patches. Reset Trinity to local “origin/master”

echo.

call %Git% reset --hard “origin/master”

echo.

echo.

echo ### Pull Trinity to latest version

echo.

call %Git% pull

echo.

)

echo.

echo ### Clone/Pull Trinity DB

echo.

IF not exist %f_database% (

echo - Create folder “%f_database%”

echo.

md %f_database%

echo.

echo - Checkout %repo_database%

echo.

call %HG% clone %repo_database% %f_database%

echo.

)ELSE (

cd %f_database%

call %HG% pull

echo.

)

echo.

echo ### Clone/Pull Trinity DB German

echo.

IF not exist %f_database_ger% (

echo - Create folder “%f_database_ger%”

echo.

md %f_database_ger%

echo.

echo - Checkout %repo_database_ger%

call %SVN% /command:checkout /url:%repo_database_ger% /path:%f_database_ger% /closeonend:1

echo Done!

echo.

)ELSE (

echo - Update from %repo_database_ger%

call %SVN% /command:update /path:%f_database_ger% /closeonend:1

echo - Done!

echo.

)

echo.

echo ### Merge German-DB SQL files…

echo.

echo - Create “%f_database_ger%_all.sql”

IF exist “%f_database_ger%_all.sql” del “%f_database_ger%_all.sql”

for /r “%f_database_ger%\sql" %%i in (”*.sql") do if exist %%i (call type “%%i” >> “%f_database_ger%_all.sql”)

echo - Done!

echo.

echo.

echo 2. Apply Patches ###

echo ###############################################################################

echo.

cd %f_sources%

echo ### Clean patch que, remove not sucessfully aplied patches

call %Git% am --3way --abort

echo.

REM echo ### Apply Patch Auction House Bot

REM for /r “%f_patches1%\11024-independent" %%i in (”*-Ahbot.patch") do if exist %%i (call %Git% am --signoff “%%i”)

REM echo.

REM echo.

REM echo ### Apply Patch Auction House Bot and VIP

REM echo.

REM for /r “%f_patches2%\Individual" %%i in (”*-AHBOT-VIPAccounts.patch") do if exist %%i (call %Git% am --3way --signoff “%%i”)

REM echo.

REM echo.

REM echo ### Apply Patch GM-1-Normal

REM echo.

REM for /r “%f_patches2%\Individual" %%i in (”*-GM-1-NORMAL.patch") do if exist %%i (call %Git% am --3way --signoff “%%i”)

REM echo.

echo.

echo ### Apply AHBot and Glyphs patch

for /r “%f_patches1%\11024-independent" %%i in (”*-ahbot_glyphs.patch") do if exist %%i (call %Git% am --signoff “%%i”)

echo.

echo.

echo 3. cMake ###

echo ###############################################################################

echo.

IF exist %f_build% (

echo ### Remove “%f_build%” for fresh cmake

call rd /s /q %f_build%

echo.

echo - Done!

echo.

)

echo.

echo ### Create folder “%f_build%”

md %f_build_release%

echo.

echo - Done!

echo.

echo.

echo ### Start cMake

echo.

cd %f_build%

call %CMAKE% -G %cMake_Generator% %f_sources%

echo.

echo.

echo 4. Compile with VisualStudio CommandLine ###

echo ###############################################################################

echo.

echo - This will take some minutes…

echo - Get a coffee, check your mail, tidy up…

echo - You will not see any messages until finished…

echo - But you can check the logfile: “%f_build_release%build_%Date%.txt”

call %VisualStudio% /out “%f_build_release%build_%Date%.txt” /rebuild %build% “%f_build%\TrinityCore.sln”

echo.

echo 5. Copy OpenSSL DLLs ###

echo ###############################################################################

echo.

IF %cMake_Generator% == “Visual Studio 10 Win64” (

echo ### Copy 64Bit DLLs

echo.

copy %OpenSSL_3% %f_build_release%

copy %OpenSSL_4% %f_build_release%

)ELSE (

echo ### Copy 32Bit DLLs

echo.

copy %OpenSSL_1% %f_build_release%

copy %OpenSSL_2% %f_build_release%

)

echo.

echo.

echo 6. Build Trinity finished ###

echo ###############################################################################

echo.

echo - Press any key to open your binary build folder

echo - This command line will be closed.

echo.

PAUSE

explorer.exe “%f_build_release%”

REM Clear Variables ###

REM ################################################################################

set build=

set cMake_Generator=

set repo_trinity=

set repo_patch1=

set repo_patch2=

set f_sources=

set f_patches1=

set f_patches2=

set f_build=

set f_build_release=

set f_database=

set f_database_ger=

set Git=

set SVN=

set HG=

set CMake=

set VisualStudio=

set OpenSSL_1=

set OpenSSL_2=

set OpenSSL_3=

set OpenSSL_4=

REM EOF

[/SPOILER]
TrinityGit.txt

[06.01.2011]

  • now full automatic /emoticons/default_smile.png

  • now with automatic detection for Windows 32/64Bit

Edit 07.01.2011:

  • Update devsnull Patches to new structure

  • Insert find mechanism for Patchnames instead of static filenames

  • New default: apply devsnull patches “AuctionHouseBot&Glyphs”

  • To run auctionHouseBot you will need to configure it (db & config) & apply sql patch!

Edit 16.01.2011:

  • Update AuctionHouseBot and Glyphs patch to new structure, again

  • Before patch, delete every not finished/not applieable patch from patch que

Very nice

Makes compile process a lot easier.

Runs flawlessley, thank you

Although not a problem, any idea why worldserver.conf.dist dosn’t get put in the release folder?

Authserver.conf.dist does, I will add a line to move it from the source folder, just weird as vis normally does it auitomatically.

As i say not a problem, i could just be my machine.

Thanks again…

Good to hear that someone find this usefull /emoticons/default_biggrin.png

AuthServer.conf.dist problem:

The script delete the complete cmake folder, so cmake must generate everything new.

VisualStudio is advised to do a complete rebuild.

So, normally all files must be new created. /emoticons/default_huh.png

If you find an error in the script because of your environment, please tell me. I will try to fix it in the script.

Greetings

daddelkopp