News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Conditional root variables in batch build files

Started by hl2gordon, June 17, 2012, 09:00:11 PM

Previous topic - Next topic

hl2gordon

Hi Everybody,
I was going through the Code::Blocks batch build files and have some improvements:

1. Instead of setting the variables only through the batch file, we should have an option of supplying them beforehand :):
Old code:

set CB_ROOT=C:\Devel\CodeBlocks
rem ------------------------------------------
rem Setup GCC root folder with "bin" subfolder
rem ------------------------------------------
set GCC_ROOT=C:\Devel\GCC46TDM

New code:

if not defined CB_ROOT set CB_ROOT=C:\Devel\CodeBlocks
rem ------------------------------------------
rem Setup GCC root folder with "bin" subfolder
rem ------------------------------------------
if not defined GCC_ROOT set GCC_ROOT=C:\Devel\GCC46TDM

This has the added advantage that these files can be used as-is by other build scripts by simply declaring the root dirs for cb, gcc, etc.
Most other options that are configurable should also be implemented this way.

2. Since these files are in the 'src' directory, they should be able to access update.bat and instead of this:

echo Do not forget to run "update.bat" after successful build!
goto TheEnd

we should use this:

echo Running update.bat ...
call "%~dp0update.bat"
goto TheEnd

This command to run update.bat should also be configurable ( as it is preferable to run it after a full compile - i.e. cb + plugins )

Forgive me for sounding too lazy, but I have a lack of time, limited computer access ( school is going on ) and full knowledge of tools like patch and diff blocking me from providing a patch.
( Thanks to obfuscated for providing the link :))

EDIT: I was successfully able to create a patch. I was not sure where to post it though, here or on berlios so I will post it here for developers to review it before uploading it to berlios.

EDIT2: Patch updated for all scripts as of rev 8096 (conditional2.patch) and posted on berlios (PID: 003303)

Alakh

oBFusCATed

If you have svn client then you have the patch creation tool already installed.
So read this  http://wiki.codeblocks.org/index.php?title=Creating_a_patch_to_submit_to_BerliOS_%28Patch_Tracker%29 provide patches...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

hl2gordon

#2
Successfully created the patch :). See above for attachment and details.
Here is an image of me testing the new build files by setting the variables in the prompt:


ollydbg

I review the patch, and it looks good to me. Thanks. (I have no plan to try it... because I have always build c::b under c::b :))
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

hl2gordon

New patch added here and on berlios, check first post for details on the file  8)