Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: hl2gordon on June 17, 2012, 09:00:11 pm

Title: Conditional root variables in batch build files
Post by: hl2gordon on June 17, 2012, 09:00:11 pm
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:
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:
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:
Code
echo Do not forget to run "update.bat" after successful build!
goto TheEnd
we should use this:
Code
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
Title: Re: Conditional root variables in batch build files
Post by: oBFusCATed on June 17, 2012, 11:03:17 pm
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...
Title: Re: Conditional root variables in batch build files
Post by: hl2gordon on June 18, 2012, 08:52:48 pm
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:

(http://i46.tinypic.com/2qlucd3.png)
Title: Re: Conditional root variables in batch build files
Post by: ollydbg on June 20, 2012, 05:15:27 am
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 :))
Title: Re: Conditional root variables in batch build files
Post by: hl2gordon on July 09, 2012, 04:45:55 pm
New patch added here and on berlios, check first post for details on the file  8)