Lazarus & Free Pascal

Install From Source Batch-File

This Batch-File does anything for you to get Lazarus and Free Pascal from SVN-Source and compile it, only SilkSvn must be installed and you have to change the path in Line 6 of the Batch-File. You can take this Batch-File for updates too.

To get a large Win32 development environment with Win64- and linux- Cross-compiler and some additional packages you have only to start the following Batch-File. If you want only a Win32 development environment without any additional packages you call the Batch-File with parameter "min"!


@echo off
echo Install/Update Lazarus
cd \
set THUMBDRIVE=%CD:~0,2%
set fpcVersion=2.5.1
set silkSvn=%THUMBDRIVE%\SlikSvn
set svnPath=%silkSvn%\bin
if not exist %silkSvn%\NUL (
md %silkSvn%
echo be shure you have downloaded SilkSvn from http://www.sliksvn.com/en/download to dir %silkSvn% pause
)
set PATH=%svnPath%;%PATH%
set lazPath=%THUMBDRIVE%\lazarus
if exist %lazPath%\NUL (
echo Lazarus svn update, please wait ...
cd %lazPath%
svn update
) else (
echo Lazarus svn checkout, please wait ...
svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
)
if %errorlevel% NEQ 0 (
echo be shure you have downloaded SilkSvn from http://www.sliksvn.com/en/download to dir %silkSvn%
pause
goto Cleanup
)
set lazDataPath=%lazPath%\AppData
if not exist %lazDataPath%\NUL
md %lazDataPath%
set fpcPath=%lazPath%\fpc
if not exist %fpcPath%\NUL
md %fpcPath%
set fpcVersionPath=%fpcPath%\%fpcVersion%
set fpcBinPath=%fpcVersionPath%\bin\i386-win32
set PATH=%fpcVersionPath%;%lazDataPath%;%fpcBinPath%;%PATH%
if exist %fpcVersionPath%\NUL (
echo Free Pascal svn update, please wait ...
cd %fpcVersionPath% svn update
) else (
echo Free Pascal svn checkout, please wait ...
cd %fpcPath%
svn checkout http://svn.freepascal.org/svn/fpc/trunk %fpcVersion%
)
if %errorlevel% NEQ 0 goto Cleanup
if not exist %fpcBinPath%\NUL (
if not exist %fpcVersionPath%\bin\NUL
md %fpcVersionPath%\bin
cd %fpcVersionPath%\bin
echo Free Pascal Build Binarys svn checkout, please wait ...
svn checkout http://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32 i386-win32
if %errorlevel% NEQ 0 echo SVN checkout failed!
for /F "tokens=*" %%G IN ('DIR /B /AD /S %fpcBinPath%\*.svn*') DO RMDIR /S /Q "%%G"
echo Free Pascal Bin Utils svn checkout, please wait ...
svn checkout http://svn.freepascal.org/svn/fpcbuild/branches/fixes_2_4/install/binw32 i386-win32
if %errorlevel% NEQ 0
echo SVN checkout failed!
for /F "tokens=*" %%G IN ('DIR /B /AD /S %fpcBinPath%\*.svn*') DO RMDIR /S /Q "%%G"
echo get ppc386-win32.zip
cd %fpcBinPath%
goto ppc386
:ppcunzip
unzip ppc386-win32.zip
del ppc386-win32.zip
)
if "%1"=="min" goto noPackages
if exist %fpcPath%\fpcprojects\NUL (
echo Free Pascal Projects svn update, please wait ...
cd %fpcPath%\fpcprojects svn update
) else (
echo Free Pascal Projects svn checkout, please wait ...
cd %fpcPath%
svn checkout http://svn.freepascal.org/svn/fpcprojects fpcprojects
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %fpcPath%\fpcdocs\NUL (
echo Free Pascal Docs svn update, please wait ...
cd %fpcPath%\fpcdocs svn update
) else (
echo Free Pascal Docs svn checkout, please wait ...
cd %fpcPath% svn checkout http://svn.freepascal.org/svn/fpcdocs/trunk fpcdocs
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %lazPath%\lazarus-ccr\NUL (
echo Lazarus-CCR svn update, please wait ...
cd %lazPath%\lazarus-ccr svn update
) else (
echo Lazarus-CCR svn checkout, please wait ...
cd %lazPath% svn checkout http://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr lazarus-ccr
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
set packagesPath=%lazPath%\packages
if not exist %lazPath%\packages\NUL
md %packagesPath%
if exist %packagesPath%\lazupdater\NUL (
echo Lazarus Updater svn update, please wait ...
cd %packagesPath%\lazupdater svn update
) else (
echo Lazarus Updater svn checkout, please wait ...
cd %packagesPath%
svn checkout http://svn.lazarusforum.de/svn/lazupdater/trunk lazupdater
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %packagesPath%\lnet\NUL (
echo lnet svn update, please wait ...
cd %packagesPath%\lnet svn update
) else (
echo lnet svn checkout, please wait ...
cd %packagesPath%
svn checkout http://svn.freepascal.org/svn/fpcprojects/lnet/trunk lnet
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %packagesPath%\powtils\NUL (
echo Lazarus Powtils svn update, please wait ...
cd %packagesPath%\powtils svn update
) else (
echo Lazarus Powtils svn update, please wait ...
cd %packagesPath% svn checkout http://powtils.googlecode.com/svn powtils
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %packagesPath%\Indy\NUL (
echo Indy svn update, please wait ...
cd %packagesPath%\Indy
svn update
) else (
echo Indy svn checkout, please wait ...
cd %packagesPath% svn checkout https://svn.atozed.com:444/svn/Indy10/trunk Indy --username Indy-Public-RO
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %packagesPath%\Jedi_jcl\NUL (
echo Jedi JCL svn update, please wait ...
cd %packagesPath%\Jedi_jcl
svn update
) else (
echo Jedi JCL svn checkout, please wait ...
cd %packagesPath%
svn checkout http://jcl.svn.sourceforge.net/svnroot/jcl/trunk/jcl Jedi_jcl
)
if %errorlevel% NEQ 0
echo SVN update/checkout failed!
if exist %packagesPath%\Jedi_jvcl\NUL (
echo Jedi JVCL svn update, please wait ...
cd %packagesPath%\Jedi_jvcl
svn update
) else (
echo Jedi JVCL svn checkout, please wait ...
cd %packagesPath%
svn checkout http://jvcl.svn.sourceforge.net/svnroot/jvcl/trunk/jvcl Jedi_jvcl
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
if exist %packagesPath%\OverbyteIcs\NUL (
echo Overbyte ICS svn update, please wait ...
cd %packagesPath%\OverbyteIcs
svn update
) else (
echo Overbyte ICS svn checkout, please wait ...
cd %packagesPath%
svn checkout http://svn.overbyte.be:8443/svn/ics/branches/icsv7/Delphi/Vc32 OverbyteIcs --username ics --password ics
)
if %errorlevel% NEQ 0 echo SVN update/checkout failed!
:noPackages
echo install fpc i386-win32, please wait ...
cd %fpcVersionPath%
if exist %fpcBinPath%\fpc.exe (
set compiler=fpc.exe
) else (
set compiler=ppc386.exe
)
make clean all install OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=%fpcVersionPath% PP=%compiler% > NUL
if not exist %fpcBinPath%\fpc.cfg (
echo create fpc.cfg
cd %fpcBinPath%
fpcmkcfg -d basepath=%fpcVersionPath% -o fpc.cfg
) cd %fpcVersionPath%
if "%1"=="min" goto noFpcCross
echo crossinstall fpc x86_64-win64, please wait ...
make clean all crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=%fpcVersionPath% PP=fpc.exe > NUL
echo crossinstall fpc i386-linux, please wait ...
make clean all crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=%fpcVersionPath% PP=fpc.exe > NUL
:noFpcCross echo cleanup, please wait ...
make clean > NUL FOR /F "tokens=*" %%G IN ('DIR /B /AD /S %fpcVersionPath%\examples\*.svn*') DO RMDIR /S /Q "%%G"
echo install lazarus win32, please wait ...
cd %lazPath%
make clean all OPT="-glw2" > NUL
echo make lcl / ide win32, please wait ...
make lazbuilder OPT="-Xs -XX" PP=fpc.exe > NUL
if "%1"=="min" goto noLazCross
echo make lcl win64, please wait ...
make lcl OPT="-Xs -XX" LCL_PLATFORM=win32 PP=fpc.exe CPU_TARGET=x86_64 OS_TARGET=win64 > NUL
make lcl OPT="-Xs -XX" LCL_PLATFORM=nogui PP=fpc.exe CPU_TARGET=x86_64 OS_TARGET=win64 > NUL
echo make lcl linux, please wait ...
rem make lcl OPT="-Xs -XX" LCL_PLATFORM=gtk2 PP=fpc.exe CPU_TARGET=i386 OS_TARGET=linux > NUL
make lcl OPT="-Xs -XX" LCL_PLATFORM=nogui PP=fpc.exe CPU_TARGET=i386 OS_TARGET=linux > NUL
:noLazCross
echo build ide
if exist lazarus.exe (
if exist lazarus.old.exe (
del lazarus.old.exe
)
ren lazarus.exe lazarus.old.exe
)
lazbuild -B --primary-config-path=%lazDataPath% --build-ide= > NUL
ren lazarus.new.exe lazarus.exe
echo strip and upx, please wait ...
strip --strip-all lazarus.exe > NUL
upx lazarus.exe > NUL
strip --strip-all startlazarus.exe > NUL
upx startlazarus.exe > NUL
strip --strip-all lazbuild.exe > NUL
upx lazbuild.exe > NUL
echo make lazarus examples, please wait ...
cd %lazPath%\examples
make > NUL goto Exit
:Cleanup
echo.
echo Something went wrong, trying to fix any problems if possible ...
svn cleanup
if %errorlevel% NEQ 0 (
cd ..
echo.
echo Cleanup Failed ! Please check or delete/move/rename the subdirectory ...
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S %fpcVersionPath%\examples\*.svn*') DO RMDIR /S /Q "%%G"
goto Exit
)
cd \ echo.
echo Cleanup complete please run the script again.
:Exit
echo ---- ENDE ----
pause exit /b
:ppc386
ftp -i -s:"%~f0"&goto:ppcunzip
open ftp.freepascal.org anonymous password
cd pub/fpc/dist/2.4.0/bootstrap binary
mget ppc386-win32.zip
disconnect bye