Release RMC-06.02
(2024-04-29)
|
ContentsDescriptionPurpose| General| Calling| Environment Variables| Additional Available Environment Variables| Special Environment Variables| Layout| Notes
Example of a switch.gbs.batDescriptionPurposeThe switch.gbs script file is located in the GBS_SYSTEM_PATH directory and
is used to define the environment in which the System has to function.
To edit the file: gbsedit switch.gbs In GBS the switch.gbs script file and the site.gbs script file are the only files allowed to contain absolute disk-addresses GeneralSpecial considerations:
CallingThe switch.gbs file is called:
Environment VariablesEnvironment Variables defined in the switch.gbs file should be in uppercase.When referring to external data (directories/files) they should be prefixed with GBSEXT_. (Not GBS_EXT_) When exiting a System, GBS will unset all GBSEXT_ Environment Variables that were set at 'entry'. This is done before the switch.gbs is called with the 'exit' parameter. The only sensible thing to do in the 'exit' part is to call a script or program. But this will be extremely rare. Note that at the moment of invocation all GBS internal Environment Variables for that System have been set. Additional Available Environment VariablesThese are defined before execution of the switch.gbs file and can be used to control additional settings.They may never be changed!
Special Environment VariablesYou can specify 'special' EnvVars that give extra control the execution of gbsaudit, gbsbuild and gbsmake.These are:
LayoutThe file consists of two mayor parts:
EntryThis part is executed when you 'enter' a System (make it current)It consists of 2 Sections The ROOT sectionThis Section is where you have the Site dependent stuff.Here you will typically set GBSEXT_..._ROOT EnvVars to their Site-dependent locations As this part remains consistent for the various Systems on your computer (SITE) you can also define the GBSEXT_..._ROOT EnvVars in a separate file site.gbs(.bat/.sh) instead. (described below) The REL and PATH sectionThis Section is where you set the GBSEXT_..._RELAnd the assembly of GBSEXT_..._ROOT and GBSEXT_..._REL to GBSEXT_..._PATH In some cases (e.g. svn or git) you can set the GBSEXT_..._PATH to PATH. No GBSEXT_..._REL is needed in this case. ExitThis part is executed when you 'exit' a System (un-current it)Notes:Please note the following:
Example of a switch.gbs.bat:Example of a switch.gbs.bat:@ECHO OFF ::================================================ :: File: %FILE% :: Path: %PATH% :: System Name: %SYSTEM_NAME% ::================================================ if NOT [%1] == [entry] goto :do_exit :: :: ENTRY: set items :: ::------------------------------------------- :: ROOT Section :: This part can be deleted if <GBS_BASE_PATH>/site.gbs.bat is used ::------------------------------------------- if NOT [%GBS_SITE%] == [%SITE%] goto :NOT_%SITE% :: :: %SITE% :: :: :: Version Control :: ::set GBSEXT_GIT_ROOT=C:\Program Files\Git ::set GBSEXT_SVN_ROOT=C:\Program Files\Subversion :: :: Builds :: ::set GBSEXT_MSVS2012_ROOT=C:\Program Files (x86)\Microsoft Visual Studio 11.0 ::set GBSEXT_MSVS2012_KIT_ROOT=C:\Program Files (x86)\Windows Kits ::set GBSEXT_MSBUILD_ROOT=C:\Windows\Microsoft.NET\Framework ::set GBSEXT_MINGW_ROOT=C:\MinGW :: :: Audits :: ::set GBSEXT_QAC_ROOT=C:\MyPrograms\PRQA\QAC ::set GBSEXT_QACPP_ROOT=C:\MyPrograms\PRQA\QACPP ::set GBSEXT_PCLINT_ROOT=C:\MyPrograms\PC-Lint ::set GBSEXT_CPPTEST_ROOT=C:\MyPrograms\Parasoft\C++test :: :: Tools :: ::set GBSEXT_DOXYGEN_ROOT=C:\MyPrograms\doxygen :: :: GBS Settings :: goto :end_site :NOT_%SITE% if NOT [%GBS_SITE%] == [OTHER] goto :NOT_OTHER :: :: OTHER :: goto :end_site :NOT_OTHER echo ******* echo ** Unknown site '%GBS_SITE%' echo ** Must be one of [ %SITE% OTHER ] echo ******* ::false goto :error_exit :end_site ::-------------------------------------------- :: REL and PATH Section ::------------------------------------------- :: :: Version Control :: ::set GBSEXT_GIT_PATH=PATH ::set GBSEXT_SVN_PATH=PATH :: :: Builds :: ::set GBSEXT_MSVS2012_CONS_REL=2012 ::set GBSEXT_MSVS2012_CONS_PATH=%GBSEXT_MSVS2012_ROOT% ::set GBSEXT_MSVS2012_KIT_REL=8.0 ::set GBSEXT_MSVS2012_KIT_PATH=%GBSEXT_MSVS2012_KIT_ROOT%\%GBSEXT_MSVS2012_KIT_REL% ::set GBSEXT_MSBUILD_REL=v4.0.30319 ::set GBSEXT_MSBUILD_PATH=%GBSEXT_MSBUILD_ROOT%\%GBSEXT_MSBUILD_REL% ::set GBSEXT_MINGW_BASE_REL=2013072200 ::set GBSEXT_MINGW_CPP_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL% ::set GBSEXT_MINGW_CPP_REL=6.3.0 ::set GBSEXT_MINGW_BASE_REL=2013072200 ::set GBSEXT_MINGW_GCC_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL% ::set GBSEXT_MINGW_GCC_REL=6.3.0 :: :: Audits :: ::set GBSEXT_QAC_REL=8.1-R ::set GBSEXT_QAC_PATH=%GBSEXT_QAC_ROOT%\%GBSEXT_QAC_REL% ::set GBSEXT_QACPP_REL=3.0-R ::set GBSEXT_QACPP_PATH=%GBSEXT_QACPP_ROOT%\%GBSEXT_QACPP_REL% ::set GBSEXT_PCLINT_REL=8.00x ::set GBSEXT_PCLINT_PATH=%GBSEXT_PCLINT_ROOT%\%GBSEXT_PCLINT_REL% ::SET GBSEXT_CPPTEST_REL=9.6 ::SET GBSEXT_CPPTEST_PATH=%GBSEXT_CPPTEST_ROOT%\%GBSEXT_CPPTEST_REL% ::SET GBSEXT_CPPTEST_BUILD=9.6.0.99 :: :: Tools :: ::set GBSEXT_DOXYGEN_REL=3.5 ::set GBSEXT_DOXYGEN_PATH=%GBSEXT_DOXYGEN_ROOT% :: :: Audit Tools :: ::set QAC_REL=%GBSEXT_QAC_REL% ::set QACROOT=%GBSEXT_QAC_PATH% ::set QACPP_REL=%GBSEXT_QACPP_REL% ::set QACPPROOT=%GBSEXT_QACPP_PATH% goto end_entry_exit :do_exit if NOT [%1] == [exit] goto :no_entry_exit :: :: unset items :: goto :end_entry_exit :no_entry_exit echo ***** echo ** SYSTEM/switch.gbs: Usage = call switch.gbs.bat [ entry ^| exit ] echo ***** goto :error_exit :end_entry_exit :: true goto :EOF :error_exit :: :: Error-exit :: set GBS_RC=1 goto :EOF :::EOF::: Example of a switch.gbs.sh:#!must_be_sourced #================================================= # File: %FILE% # Path: %PATH% # System Name: %SYSTEM_NAME% #================================================= GBS_SWITCH_RC=0 if [[ $1 = "entry" ]] then # # ENTRY: set items # #-------------------------------------------- # ROOT Section # This part can be deleted if <GBS_BASE_PATH>/site.gbs.sh is used #-------------------------------------------- if [[ $GBS_SITE = "%SITE%" ]] then # # %SITE% # # # Version Control # #export GBSEXT_GIT_ROOT=PATH #export GBSEXT_SVN_ROOT=PATH # # Builds # #export GBSEXT_LGNU_CPP_ROOT=/usr/lib/gcc/x86_64-linux-gnu #export GBSEXT_LGNU_GCC_ROOT=/usr/lib/gcc/x86_64-linux-gnu # # Audits # #export GBSEXT_QAC_ROOT=/apl/cadappl_linux_ia32/qac #export GBSEXT_QACPP_ROOT=/apl/cadappl_linux_ia32/qac++ # # Tools # # # GBS Settings # true elif [[ $GBS_SITE = "OTHER" ]] then # # OTHER # true else echo "SWITCH.GBS: *****" echo "SWITCH.GBS: ** Unknown Site $GBS_SITE" echo "SWITCH.GBS: ** Must be one of '%SITE% OTHER'" echo "SWITCH.GBS: *****" GBS_SWITCH_RC=1 fi #-------------------------------------------- # REL and PATH Section #-------------------------------------------- if [[ $GBS_SWITCH_RC = 0 ]] then # # Version Control # #export GBSEXT_GIT_PATH=PATH #export GBSEXT_SVN_PATH=PATH # # Builds # #export GBSEXT_LGNU_CPP_REL=7 #export GBSEXT_LGNU_CPP_PATH=$GBSEXT_LGNU_CPP_ROOT/$GBSEXT_LGNU_CPP_REL #export GBSEXT_LGNU_GCC_REL=7 #export GBSEXT_LGNU_GCC_PATH=$GBSEXT_LGNU_GCC_ROOT/$GBSEXT_LGNU_GCC_REL # # Audits # #set GBSEXT_QAC_REL=8.1-R #set GBSEXT_QAC_PATH=$GBSEXT_QAC_ROOT-$GBSEXT_QAC_REL #set GBSEXT_QACPP_REL=3.0-R #set GBSEXT_QACPP_PATH=$GBSEXT_QACPP_ROOT-$GBSEXT_QACPP_REL # # Tools # true fi elif [[ $1 = "exit" ]] then # # EXIT: unset items # true else echo "SWITCH.GBS: *****" echo "SWITCH.GBS: ** switch.gbs.sh: Usage = . switch.gbs.sh [ entry | exit ]" echo "SWITCH.GBS: *****" GBS_SWITCH_RC=1 fi [[ $GBS_SWITCH_RC = 1 ]] && export GBS_RC=1 unset GBS_SWITCH_RC ##EOF## |