delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/09/11/12:47:45

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Subject: DJGPP environment batch file
To: djgpp AT delorie DOT com
X-Mailer: Lotus Notes Release 7.0.2 September 26, 2006
Message-ID: <OF8EFFB4BA.484BB724-ON87257353.005BD61B-87257353.005C3A31@seagate.com>
From: Gordon DOT Schumacher AT seagate DOT com
Date: Tue, 11 Sep 2007 10:47:23 -0600
X-MIMETrack: Serialize by Router on SV-GW1/Seagate Internet(Release 7.0.1 HF29|March 07, 2006) at
09/11/2007 09:47:27 AM
MIME-Version: 1.0
X-Proofpoint-FWRule: outbound2
X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.5502:2.3.11,1.2.37,4.0.164 definitions=2007-09-11_04:2007-09-11,2007-09-11,2007-09-11 signatures=0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l8BGle3q000814

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019