DJGPP environment batch file




This might be useful to someone, so here it is...

This batch file detects the operating system that it is running under
heuristically and sets up the environment variables appropriately. It does
want the DJDIR var already set - if it's not, it will look for C:\DJGPP as
a guess and then give up.

Additionally you can use it to run a particular command inside a DJGPP
shell as follows:
DJGPP bash -c "cd c:/myproject; make"

I use this to avoid collisions between the six (!) different development
environments I have on my system - *none* of them are in my path by
default, so I have little scripts like this to select one.

@echo off
if "%DJDIR%"=="" if exist C:\DJGPP set DJDIR=C:\DJGPP
if "%DJDIR%"=="" goto nodjdir
set DJGPP=%DJDIR%\DJGPP.ENV
set SHELL=%DJDIR%\bin\bash.exe
set HOME=/
set LD_LIBRARY_PATH=%DJDIR%/lib
set QMAKESPEC=dos-g++
set TERM=ansi.sys

rem Configure add-on modules
set MGL_ROOT=%DJDIR%/SciTech

rem Look for DJGPP in the PATH
path | %DJDIR%\bin\grep -i "%DJDIR%\bin" >NUL:
if errorlevel 1 set PATH=%DJDIR%\bin;%path%

rem Check if LFN is set first...
if not "%LFN%"=="" goto done
set LFN=N

if "%windir%"=="" goto nolfn
if "%OS%"=="Windows_NT" goto winnt
rem if we get here it must be Win9x
goto lfn

:winnt
rem if it's NT and it's got USB, it must be 2K or newer
if exist "%windir%\system32\usb*.*" goto lfn
goto nolfn

:lfn
set LFN=Y
goto done

:nolfn
set LFN=N
goto done

:nodjdir
echo You must have the DJDIR environment variable set!
echo Aborting...
echo 1 ¦ CHOICE /C:1 /N >NUL
goto exit

:done
if "%1"=="" goto exit
if "%OS%"=="Windows_NT" %*
if not "%OS%"=="Windows_NT" %1 %2 %3 %4 %5 %6 %7 %8 %9

:exit


.



Relevant Pages