diff --git a/.gitattributes b/.gitattributes
index 62c6f2b173..523f481e71 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1585,6 +1585,10 @@ tools/install/get_lazarus_version.sh -text svneol=native#application/x-sh
tools/install/macosx/fpc_installer_info.zip -text svneol=unset#application/zip
tools/install/replace_in_files.pl -text svneol=native#application/x-perl
tools/install/smart_strip.sh -text svneol=native#application/x-sh
+tools/install/win32/build-fpc.bat -text svneol=native#application/x-msdos-program
+tools/install/win32/build-lazarus.bat -text svneol=native#application/x-msdos-program
+tools/install/win32/create_installer.bat -text svneol=native#application/x-msdos-program
+tools/install/win32/environmentoptions.xml svneol=native#text/xml
tools/install/win32/readme.txt svneol=native#text/plain
tools/lazarusmake.ini svneol=native#text/plain
tools/lazres.lpi svneol=native#text/plain
diff --git a/tools/install/win32/build-fpc.bat b/tools/install/win32/build-fpc.bat
new file mode 100644
index 0000000000..c7975e4577
--- /dev/null
+++ b/tools/install/win32/build-fpc.bat
@@ -0,0 +1,30 @@
+SET OLDCURDIR=%CD%
+
+SET SOURCE_DIR=%FPCCVSDIR%
+SET INSTALL_BASE=%BUILDDIR%\pp
+SET INSTALL_BINDIR=%INSTALL_BASE%\bin\win32
+
+copy %FPCBINDIR%\as.exe %FPCBINDIR%\asw.exe
+copy %FPCBINDIR%\ld.exe %FPCBINDIR%\ldw.exe
+
+cd %SOURCE_DIR%
+%MAKEEXE% clean PP=%RELEASE_PPC% >> %LOGFILE%
+%MAKEEXE% compiler_cycle PP=%RELEASE_PPC% >> %LOGFILE%
+
+del %FPCBINDIR%\asw.exe
+del %FPCBINDIR%\ldw.exe
+
+set COMPILER=%SOURCE_DIR%/compiler/ppc386
+
+%MAKEEXE% -C rtl clean PP=%COMPILER% >> %LOGFILE%
+%MAKEEXE% -C packages clean PP=%COMPILER% >> %LOGFILE%
+%MAKEEXE% -C fcl clean PP=%COMPILER% >> %LOGFILE%
+%MAKEEXE% rtl packages_base_all fcl packages_extra_all PP=%COMPILER% OPT="-g -gl" >> %LOGFILE%
+%MAKEEXE% utils PP=%COMPILER% OPT="-CX -XX -Xs" >> %LOGFILE%
+
+%MAKEEXE% compiler_install rtl_install fcl_install packages_install utils_install INSTALL_PREFIX=%INSTALL_BASE% PP=%COMPILER% FPCMAKE=%FPCCVSDIR%\utils\fpcm\fpcmake.exe >> %LOGFILE%
+
+SET COMPILER=%INSTALL_BASE%\bin\win32\ppc386.exe
+%MAKEEXE% clean PP=%COMPILER% >> %LOGFILE%
+
+cd %OLDCURDIR%
\ No newline at end of file
diff --git a/tools/install/win32/build-lazarus.bat b/tools/install/win32/build-lazarus.bat
new file mode 100644
index 0000000000..357978ca80
--- /dev/null
+++ b/tools/install/win32/build-lazarus.bat
@@ -0,0 +1,12 @@
+SET OLDCURDIR=%CD%
+
+SET COMPILER=%BUILDDIR%\pp\bin\win32\ppc386.exe
+
+cd %BUILDDIR%
+%MAKEEXE% clean PP=%COMPILER% >> %LOGFILE%
+%MAKEEXE% all OPT="-gl -Xs" PP=%COMPILER% >> %LOGFILE%
+%FPCBINDIR%\strip.exe lazarus.exe
+
+%FPCBINDIR%\strip.exe startlazarus.exe
+
+cd %OLDCURDIR%
\ No newline at end of file
diff --git a/tools/install/win32/create_installer.bat b/tools/install/win32/create_installer.bat
new file mode 100644
index 0000000000..00be9c357d
--- /dev/null
+++ b/tools/install/win32/create_installer.bat
@@ -0,0 +1,68 @@
+:: These settings need to change for every build
+SET LAZVERSION=0.9.2.2a
+
+:: These setting are dependent on the configuration of the build machine
+:: Path to the Inno Setup Compiler
+SET ISCC="C:\Program Files\Inno Setup 4\iscc.exe"
+
+:: Path to the fpc sources checked out of cvs
+SET FPCCVSDIR=c:\lazarus\source\fpc-1.9
+
+:: Path to the lazarus sources checked out of cvs
+SET LAZCVSDIR=c:\lazarus\source\lazarus
+
+:: Path to fpc 1.0.10 compiler
+SET RELEASE_PPC=c:\fpc\bin\ppc386-release.exe
+
+:: Path to the directory containing some third party utilities used by fpc
+:: it will be copied completely to the pp\bin\win32 directory
+:: fpc supplies them in asldw32.zip, makew32.zip
+SET FPCBINDIR=c:\lazarus\source\fpcbindir
+
+:: Path to build directory.
+:: In this directory an image of the installation will be built.
+SET BUILDDIR=c:\temp\lazbuild
+
+:: Path to the tool to create an export using a local cvs directory
+SET EXPORTCVS=%LAZCVSDIR%\tools\install\copycvsdir\copycvsdir.exe
+
+
+::=====================================================================
+:: no change needed after this.
+
+:: Some internal variables
+SET MAKEEXE=%FPCBINDIR%\mingw32-make.exe
+SET LOGFILE=%CD%\installer.log
+SET DATESTAMP=%date:~-4,4%%date:~-7,2%%date:~-10,2%
+
+ECHO Starting at: > %LOGFILE%
+%FPCBINDIR%\gdate >> %LOGFILE%
+
+:: set path to make sure the right tools are used
+SET OLDPATH=%PATH%
+SET PATH=%FPCBINDIR%
+
+:: copy lazarus dir
+%EXPORTCVS% %LAZCVSDIR% %BUILDDIR% >> %LOGFILE%
+
+:: copy fpc source
+%EXPORTCVS% %FPCCVSDIR%\rtl %BUILDDIR%\fpcsrc\rtl >> %LOGFILE%
+%EXPORTCVS% %FPCCVSDIR%\fcl %BUILDDIR%\fpcsrc\fcl >> %LOGFILE%
+%EXPORTCVS% %FPCCVSDIR%\packages %BUILDDIR%\fpcsrc\packages >> %LOGFILE%
+
+call build-fpc.bat
+copy %FPCBINDIR%\*.* %BUILDDIR%\pp\bin\win32 >> %LOGFILE%
+samplecfg.vbs
+
+call build-lazarus.bat
+
+:: create the installer
+%ISCC% lazarus.iss >> installer.log
+
+:: delete build dir
+del /s /q %BUILDDIR% > NUL
+
+SET PATH=%OLDPATH%
+
+ECHO Finished at:
+%FPCBINDIR%\gdate >> %LOGFILE%
diff --git a/tools/install/win32/environmentoptions.xml b/tools/install/win32/environmentoptions.xml
new file mode 100644
index 0000000000..50590872ba
--- /dev/null
+++ b/tools/install/win32/environmentoptions.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/install/win32/lazarus.iss b/tools/install/win32/lazarus.iss
new file mode 100644
index 0000000000..16f32d8364
--- /dev/null
+++ b/tools/install/win32/lazarus.iss
@@ -0,0 +1,94 @@
+[_ISTool]
+EnableISX=true
+[Defines]
+#define AppVersion GetEnv('LazVersion')
+#define AppName "Lazarus"
+#define SetupDate GetEnv('DateStamp')
+#define BuildDir GetEnv('BuildDir')
+[Setup]
+AppName={#AppName}
+AppVersion={#AppVersion}
+AppVerName={#AppName} {#AppVersion}
+AppPublisherURL=http://www.lazarus.freepascal.org/
+AppSupportURL=http://www.lazarus.freepascal.org/
+AppUpdatesURL=http://www.lazarus.freepascal.org/
+LicenseFile={#BuildDir}\COPYING
+DefaultDirName={code:GetDefDir|c:\lazarus}
+DefaultGroupName={#AppName}
+OutputBaseFilename={#AppName}-{#AppVersion}-{#SetupDate}
+InternalCompressLevel=ultra
+SolidCompression=true
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+Source: {#BuildDir}\*.*; DestDir: {app}; Flags: recursesubdirs
+Source: environmentoptions.xml; DestDir: {app}; Flags: onlyifdoesntexist; AfterInstall: UpdateEnvironmentOptions
+Source: samplefpc.cfg; DestDir: {app}\pp\bin\win32; Flags: onlyifdoesntexist; AfterInstall: UpdateFpcCfg; DestName: fpc.cfg
+
+[Icons]
+Name: {group}\{#AppName}; Filename: {app}\startlazarus.exe
+Name: {group}\{cm:UninstallProgram,Lazarus}; Filename: {uninstallexe}
+Name: {userdesktop}\Lazarus; Filename: {app}\startlazarus.exe; Tasks: desktopicon
+
+[Code]
+function NextButtonClick(CurPage: Integer): Boolean;
+var
+ folder: String;
+begin
+
+ // by default go to next page
+ Result := true;
+
+ // if curpage is wpSelectDir check is filesystem
+ if CurPage = wpSelectDir then
+ begin
+
+ folder := WizardDirValue;
+
+ if Pos( ' ', folder ) > 0 then
+ begin
+ MsgBox( 'Selected folder contains spaces, please select a folder without spaces in it.', mbInformation, MB_OK );
+
+ Result := false;
+ end
+
+ end;
+
+end;
+
+function GetDefDir( def: String ) : String;
+begin
+ // if default folder contains spaces, suggest user to install in folderwithnospaces\Myappdir
+ if Pos( ' ', def ) > 0 then
+ begin
+ def := Copy( def, 1, Pos( ' ', def ) - 1 ) + '\NoFolderSpace';
+ end;
+ Result := def;
+end;
+
+procedure UpdateEnvironmentOptions();
+var
+ FileName: string;
+ Content: string;
+begin
+ FileName := ExpandConstant(CurrentFileName);
+ LoadStringFromFile(FileName, Content);
+ StringChange(Content, '%Temp%', GetTempDir);
+ StringChange(Content, '%LazDir%', ExpandConstant('{app}'));
+ StringChange(Content, '%FpcSrcDir%', ExpandConstant('{app}\fpcsrc'));
+ StringChange(Content, '%FpcBinDir%', ExpandConstant('{app}\pp\bin\win32'));
+ SaveStringToFile(FileName, Content, False);
+end;
+
+procedure UpdateFpcCfg();
+var
+ FileName: string;
+ Content: string;
+begin
+ FileName := ExpandConstant(CurrentFileName);
+ LoadStringFromFile(FileName, Content);
+ StringChange(Content, '$1', ExpandConstant('{app}\pp'));
+ SaveStringToFile(FileName, Content, False);
+end;
diff --git a/tools/install/win32/samplecfg.vbs b/tools/install/win32/samplecfg.vbs
new file mode 100644
index 0000000000..967e07505c
--- /dev/null
+++ b/tools/install/win32/samplecfg.vbs
@@ -0,0 +1,28 @@
+Option explicit
+
+Dim WSHShell
+Dim FS
+Dim InFileName
+Dim OutFileName
+Dim PPDir
+Dim InFile
+Dim OutFile
+Dim AllText
+Dim NewText
+
+Set WSHShell = WScript.CreateObject("WScript.Shell")
+
+InFileName = "samplefpc.cfg"
+OutFileName = WSHShell.ExpandEnvironmentStrings("%BuildDir%")& "\pp\bin\win32\fpc.cfg"
+PPDir = WSHShell.ExpandEnvironmentStrings("%BuildDir%") & "\pp"
+
+Set fs = CreateObject("Scripting.FileSystemObject")
+Set InFile = fs.OpenTextFile(InFileName)
+AllText = InFile.ReadAll
+InFile.Close
+
+NewText = Replace(AllText,"$1",PPDIR,1, -1,0)
+
+Set OutFile = fs.CreateTextFile(OutFileName, True)
+OutFile.WriteLine(NewText)
+OutFile.Close
\ No newline at end of file
diff --git a/tools/install/win32/samplefpc.cfg b/tools/install/win32/samplefpc.cfg
new file mode 100644
index 0000000000..9be74c81e9
--- /dev/null
+++ b/tools/install/win32/samplefpc.cfg
@@ -0,0 +1,173 @@
+#
+# Example fpc.cfg for Free Pascal Compiler Version 1.9.0
+#
+
+# ----------------------
+# Defines (preprocessor)
+# ----------------------
+
+#
+# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
+#
+# -d is the same as #DEFINE
+# -u is the same as #UNDEF
+#
+
+#
+# Some examples (for switches see below, and the -? helppages)
+#
+# Try compiling with the -dRELEASE or -dDEBUG on the commandline
+#
+
+# For a release compile with optimizes and strip debuginfo
+#IFDEF RELEASE
+ -OG2p2
+ -Xs
+ #WRITE Compiling Release Version
+#ENDIF
+
+# For a debug version compile with debuginfo and all codegeneration checks on
+#IFDEF DEBUG
+ -g
+ -Crtoi
+ #WRITE Compiling Debug Version
+#ENDIF
+
+# ----------------
+# Parsing switches
+# ----------------
+
+# All assembler blocks are intel styled by default
+#-Rintel
+
+# All assembler blocks are AT&T styled by default
+#-Ratt
+
+# All assembler blocks are directly copied to asm
+#-Rdirect
+
+# Semantic checking
+# -S2 switch some Delphi 2 extensions on
+# -Sc supports operators like C (*=,+=,/= and -=)
+# -Sd tries to be Delphi compatible
+# -Se compiler stops after the errors (default is 1)
+# -Sg allow LABEL and GOTO
+# -Sh Use ansistrings
+# -Si support C++ styled INLINE
+# -Sm support macros like C (global)
+# -So tries to be TP/BP 7.0 compatible
+# -Sp tries to be gpc compatible
+# -Ss constructor name must be init (destructor must be done)
+# -St allow static keyword in objects
+# Allow goto, inline, C-operators
+-Sgic
+
+# ---------------
+# Code generation
+# ---------------
+
+# Uncomment the next line if you always want static/dynamic units by default
+# (can be overruled with -CD, -CS at the commandline)
+#-CS
+#-CD
+
+# Set the default heapsize to 8Mb
+#-Ch8000000
+
+# Set default codegeneration checks (iocheck, overflow, range, stack)
+#-Ci
+#-Co
+#-Cr
+#-Ct
+
+# Optimizer switches
+# -Og generate smaller code
+# -OG generate faster code (default)
+# -Or keep certain variables in registers (still BUGGY!!!)
+# -Ou enable uncertain optimizations (see docs)
+# -O1 level 1 optimizations (quick optimizations)
+# -O2 level 2 optimizations (-O1 + slower optimizations)
+# -O3 level 3 optimizations (same as -O2u)
+# -Op target processor
+# -Op1 set target processor to 386/486
+# -Op2 set target processor to Pentium/PentiumMMX (tm)
+# -Op3 set target processor to PPro/PII/c6x86/K6 (tm)
+
+# Optimize always for Size and Pentium
+#-Og2p2
+
+
+# -----------------------
+# Set Filenames and Paths
+# -----------------------
+
+# Both slashes and backslashes are allowed in paths
+
+# path to the messagefile, not necessary anymore but can be used to override
+# the default language
+#-Fr$1/msg/errore.msg
+#-Fr$1/msg/errorn.msg
+#-Fr$1/msg/errores.msg
+#-Fr$1/msg/errord.msg
+#-Fr$1/msg/errorr.msg
+
+# path to the gcclib
+#-Fl$1/lib
+
+# searchpath for includefiles
+# release them only if you know what you do
+# because this could cause a rebuild of the runtime library
+# if you tell them compiler/ide to build the project (FK)
+#-Fi$1/source/rtl/inc;$1/source/rtl/i386
+
+# searchpath for objectfiles
+#-Fo$1/source/rtl/inc;$1/source/rtl/i386
+
+# searchpath for units and other system dependent things
+-Fu$1/units/$TARGET
+-Fu$1/units/$TARGET/*
+-Fu$1/units/$TARGET/rtl
+
+# searchpath for libraries
+#-Fl$1/lib
+#-Fl/lib;/usr/lib
+
+# searchpath for tools
+-FD$1/bin/$TARGET
+
+# -------------
+# Linking
+# -------------
+
+# generate always debugging information for GDB (slows down the compiling
+# process)
+#-gl
+
+# always pass an option to the linker
+#-k-s
+
+# Always strip debuginfo from the executable
+-Xs
+
+
+# -------------
+# Miscellaneous
+# -------------
+
+# Write always a nice FPC logo ;)
+-l
+
+# Verbosity
+# e : Show errors (default) d : Show debug info
+# w : Show warnings u : Show used files
+# n : Show notes t : Show tried files
+# h : Show hints m : Show defined macros
+# i : Show general info p : Show compiled procedures
+# l : Show linenumbers c : Show conditionals
+# a : Show everything 0 : Show nothing (except errors)
+
+# Display Info, Warnings, Notes and Hints
+-viwnh
+# If you don't want so much verbosity use
+#-vw
+