Author Topic: Conditional root variables in batch build files  (Read 7157 times)

Offline hl2gordon

  • Single posting newcomer
  • *
  • Posts: 6
Conditional root variables in batch build files
« 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
« Last Edit: July 09, 2012, 04:43:17 pm by hl2gordon »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Conditional root variables in batch build files
« Reply #1 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...
(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!]

Offline hl2gordon

  • Single posting newcomer
  • *
  • Posts: 6
Re: Conditional root variables in batch build files
« Reply #2 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:

« Last Edit: July 10, 2012, 02:49:22 pm by hl2gordon »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5970
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Conditional root variables in batch build files
« Reply #3 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 :))
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.

Offline hl2gordon

  • Single posting newcomer
  • *
  • Posts: 6
Re: Conditional root variables in batch build files
« Reply #4 on: July 09, 2012, 04:45:55 pm »
New patch added here and on berlios, check first post for details on the file  8)