Browse Source

* more properties fixed

git-svn-id: trunk@14156 -
florian 15 năm trước cách đây
mục cha
commit
851b00f8e9

+ 15 - 15
.gitattributes

@@ -127,7 +127,7 @@ compiler/cp850.pas svneol=native#text/plain
 compiler/cp866.pas svneol=native#text/plain
 compiler/cp866.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
 compiler/cp8859_5.pas svneol=native#text/plain
 compiler/cp8859_5.pas svneol=native#text/plain
-compiler/crefs.pas -text
+compiler/crefs.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
@@ -6170,8 +6170,8 @@ rtl/embedded/arm/at91sam7x256.pp svneol=native#text/plain
 rtl/embedded/arm/lpc21x4.pp svneol=native#text/plain
 rtl/embedded/arm/lpc21x4.pp svneol=native#text/plain
 rtl/embedded/arm/stm32f103.pp svneol=native#text/plain
 rtl/embedded/arm/stm32f103.pp svneol=native#text/plain
 rtl/embedded/check.inc svneol=native#text/plain
 rtl/embedded/check.inc svneol=native#text/plain
-rtl/embedded/empty.cfg -text
-rtl/embedded/rtl.cfg -text
+rtl/embedded/empty.cfg svneol=native#text/plain
+rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysfile.inc svneol=native#text/plain
 rtl/embedded/sysfile.inc svneol=native#text/plain
 rtl/embedded/sysheap.inc svneol=native#text/plain
 rtl/embedded/sysheap.inc svneol=native#text/plain
@@ -7090,7 +7090,7 @@ rtl/symbian/Makefile svneol=native#text/plain
 rtl/symbian/Makefile.fpc svneol=native#text/plain
 rtl/symbian/Makefile.fpc svneol=native#text/plain
 rtl/symbian/bindings/pbeexe.cpp -text
 rtl/symbian/bindings/pbeexe.cpp -text
 rtl/symbian/buildrtl.pp svneol=native#text/plain
 rtl/symbian/buildrtl.pp svneol=native#text/plain
-rtl/symbian/symbian.pas -text svneol=unset#text/plain
+rtl/symbian/symbian.pas svneol=native#text/plain
 rtl/symbian/symbianinc/e32def.inc svneol=native#text/plain
 rtl/symbian/symbianinc/e32def.inc svneol=native#text/plain
 rtl/symbian/symbianinc/e32err.inc svneol=native#text/plain
 rtl/symbian/symbianinc/e32err.inc svneol=native#text/plain
 rtl/symbian/symbianinc/e32std.inc svneol=native#text/plain
 rtl/symbian/symbianinc/e32std.inc svneol=native#text/plain
@@ -7100,8 +7100,8 @@ rtl/symbian/sysheap.inc svneol=native#text/plain
 rtl/symbian/sysos.inc svneol=native#text/plain
 rtl/symbian/sysos.inc svneol=native#text/plain
 rtl/symbian/sysosh.inc svneol=native#text/plain
 rtl/symbian/sysosh.inc svneol=native#text/plain
 rtl/symbian/system.pp svneol=native#text/plain
 rtl/symbian/system.pp svneol=native#text/plain
-rtl/symbian/uiq.pas -text svneol=unset#text/plain
-rtl/symbian/uiqclasses.pas -text svneol=unset#text/plain
+rtl/symbian/uiq.pas svneol=native#text/plain
+rtl/symbian/uiqclasses.pas svneol=native#text/plain
 rtl/symbian/uiqinc/qikapplication.inc svneol=native#text/plain
 rtl/symbian/uiqinc/qikapplication.inc svneol=native#text/plain
 rtl/symbian/uiqinc/qikapplicationoo.inc svneol=native#text/plain
 rtl/symbian/uiqinc/qikapplicationoo.inc svneol=native#text/plain
 rtl/ucmaps/8859-1.txt svneol=native#text/plain
 rtl/ucmaps/8859-1.txt svneol=native#text/plain
@@ -11171,15 +11171,15 @@ utils/kalyptus/kalyptus -text
 utils/kalyptus/kalyptusCxxToPas.pm -text
 utils/kalyptus/kalyptusCxxToPas.pm -text
 utils/kalyptus/kalyptusDataDict.pm -text
 utils/kalyptus/kalyptusDataDict.pm -text
 utils/mksymbian/Makefile svneol=native#text/plain
 utils/mksymbian/Makefile svneol=native#text/plain
-utils/mksymbian/Makefile.fpc -text
-utils/mksymbian/cfgfile.pas -text
-utils/mksymbian/cmdline.pas -text
-utils/mksymbian/compiler.pas -text
-utils/mksymbian/constants.pas -text
-utils/mksymbian/mksymbian.lpi -text
-utils/mksymbian/mksymbian.pas -text
-utils/mksymbian/projectparser.pas -text
-utils/mksymbian/sdkutil.pas -text
+utils/mksymbian/Makefile.fpc svneol=native#text/plain
+utils/mksymbian/cfgfile.pas svneol=native#text/plain
+utils/mksymbian/cmdline.pas svneol=native#text/plain
+utils/mksymbian/compiler.pas svneol=native#text/plain
+utils/mksymbian/constants.pas svneol=native#text/plain
+utils/mksymbian/mksymbian.lpi svneol=native#text/plain
+utils/mksymbian/mksymbian.pas svneol=native#text/plain
+utils/mksymbian/projectparser.pas svneol=native#text/plain
+utils/mksymbian/sdkutil.pas svneol=native#text/plain
 utils/postw32.pp svneol=native#text/plain
 utils/postw32.pp svneol=native#text/plain
 utils/ppdep.pp svneol=native#text/plain
 utils/ppdep.pp svneol=native#text/plain
 utils/ptop.pp svneol=native#text/plain
 utils/ptop.pp svneol=native#text/plain

+ 65 - 65
compiler/crefs.pas

@@ -1,65 +1,65 @@
-{
-    Copyright (c) 2007 by Pierre Muller
-
-    Common reference types
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
-}
-
-unit crefs;
-
-{$i fpcdefs.inc}
-
-interface
-
-uses
-  globtype,
-  cclasses;
-
-  type
-
-   TrefItem = class (TLinkedListItem)
-     refinfo  : tfileposinfo;
-     constructor create(const ARefInfo : tfileposinfo);
-     Function GetCopy:TLinkedListItem;virtual;reintroduce;
-   end;
-
-   TRefLinkedList = class(TLinkedList)
-     procedure WriteToPPU;
-   end;
-
-implementation
-
-constructor TRefItem.Create(const ARefInfo : tfileposinfo);
-begin
-  Inherited Create;
-  RefInfo:=ARefInfo;
-end;
-
-Function TRefItem.GetCopy : TLinkedListItem;
-var
-  NR : TRefItem;
-begin
-  NR.Create(RefInfo);
-  GetCopy:=NR;
-end;
-
-procedure TRefLinkedList.WriteToPPU;
-begin
-end;
-
-begin
-end.
+{
+    Copyright (c) 2007 by Pierre Muller
+
+    Common reference types
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ****************************************************************************
+}
+
+unit crefs;
+
+{$i fpcdefs.inc}
+
+interface
+
+uses
+  globtype,
+  cclasses;
+
+  type
+
+   TrefItem = class (TLinkedListItem)
+     refinfo  : tfileposinfo;
+     constructor create(const ARefInfo : tfileposinfo);
+     Function GetCopy:TLinkedListItem;virtual;reintroduce;
+   end;
+
+   TRefLinkedList = class(TLinkedList)
+     procedure WriteToPPU;
+   end;
+
+implementation
+
+constructor TRefItem.Create(const ARefInfo : tfileposinfo);
+begin
+  Inherited Create;
+  RefInfo:=ARefInfo;
+end;
+
+Function TRefItem.GetCopy : TLinkedListItem;
+var
+  NR : TRefItem;
+begin
+  NR.Create(RefInfo);
+  GetCopy:=NR;
+end;
+
+procedure TRefLinkedList.WriteToPPU;
+begin
+end;
+
+begin
+end.

+ 2 - 2
rtl/embedded/empty.cfg

@@ -1,2 +1,2 @@
-# template for an rtl with all features disabled
--Sf-
+# template for an rtl with all features disabled
+-Sf-

+ 35 - 35
rtl/embedded/rtl.cfg

@@ -1,35 +1,35 @@
-# first, disable all
--Sf-
-# uncomment to enable the stuff you want to use
-
-# include full heap management into the rtl
-# -SfHEAP
-
-# include support for init final code of units into the rtl
-# -SfINITFINAL
-
-# -SfCLASSES
-# -SfEXCEPTIONS
-# -SfEXITCODE
-# -SfANSISTRINGS
-# -SfWIDESTRINGS
-# -SfTEXTIO
-# -SfCONSOLEIO
-# -SfFILEIO
-# -SfRANDOM
-# -SfVARIANTS
-# -SfOBJECTS
-# -SfDYNARRAYS
-# -SfTHREADING
-# -SfCOMMANDARGS
-# -SfPROCESSES
-# -SfSTACKCHECK
-# -SfDYNLIBS
-
-# include exit code support
--SfEXITCODE
-
-# arm is powerful enough to handle a softfpu
-#ifdef CPUARM
--SfSOFTFPU
-#endif CPUARM
+# first, disable all
+-Sf-
+# uncomment to enable the stuff you want to use
+
+# include full heap management into the rtl
+# -SfHEAP
+
+# include support for init final code of units into the rtl
+# -SfINITFINAL
+
+# -SfCLASSES
+# -SfEXCEPTIONS
+# -SfEXITCODE
+# -SfANSISTRINGS
+# -SfWIDESTRINGS
+# -SfTEXTIO
+# -SfCONSOLEIO
+# -SfFILEIO
+# -SfRANDOM
+# -SfVARIANTS
+# -SfOBJECTS
+# -SfDYNARRAYS
+# -SfTHREADING
+# -SfCOMMANDARGS
+# -SfPROCESSES
+# -SfSTACKCHECK
+# -SfDYNLIBS
+
+# include exit code support
+-SfEXITCODE
+
+# arm is powerful enough to handle a softfpu
+#ifdef CPUARM
+-SfSOFTFPU
+#endif CPUARM

+ 39 - 39
rtl/symbian/symbian.pas

@@ -1,39 +1,39 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2007 by contributors of the Free Pascal Compiler
-
-    Symbian OS unit that adds common types, constants and functions
-    for the Symbian API
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-unit symbian;
-
-{$mode objfpc}{$H+}
-
-interface
-
-uses ctypes;
-
-{$include e32def.inc}
-{$include e32err.inc}
-{.$include e32const.inc}
-{.$include e32cmn.inc}
-{.$include e32std.inc}
-
-{ e32std.h header file }
-
-{ User class }
-
-function User_InfoPrint(aString: PChar): TInt; cdecl; external;
-
-implementation
-
-end.
-
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit symbian;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 34 - 34
rtl/symbian/uiq.pas

@@ -1,34 +1,34 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2007 by contributors of the Free Pascal Compiler
-
-    Symbian OS unit that adds common types, constants and functions
-    for the UIQ API
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-unit uiq;
-
-{$mode objfpc}{$H+}
-
-interface
-
-uses ctypes;
-
-{$include e32def.inc}
-{$include e32err.inc}
-{.$include e32const.inc}
-{.$include e32cmn.inc}
-{$include e32std.inc}
-
-
-implementation
-
-end.
-
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the UIQ API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit uiq;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{$include e32std.inc}
+
+
+implementation
+
+end.
+

+ 39 - 39
rtl/symbian/uiqclasses.pas

@@ -1,39 +1,39 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2007 by contributors of the Free Pascal Compiler
-
-    Symbian OS unit that adds common types, constants and functions
-    for the Symbian API
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-unit uiqclasses;
-
-{$mode objfpc}{$H+}
-
-interface
-
-uses ctypes;
-
-{$include e32def.inc}
-{$include e32err.inc}
-{.$include e32const.inc}
-{.$include e32cmn.inc}
-{.$include e32std.inc}
-
-{ e32std.h header file }
-
-{ User class }
-
-function User_InfoPrint(aString: PChar): TInt; cdecl; external;
-
-implementation
-
-end.
-
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit uiqclasses;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 24 - 24
utils/mksymbian/Makefile.fpc

@@ -1,24 +1,24 @@
-#
-#   Makefile.fpc for Free Pascal Symbian Build Tool
-#
-
-[target]
-programs=mksymbian
-
-[clean]
-units=cfgfile cmdline compiler constants projectparser sdkutil
-
-[require]
-packages=
-
-[compiler]
-
-[install]
-fpcpackage=y
-
-[default]
-fpcdir=../..
-
-[rules]
-.NOTPARALLEL:
-mksymbian$(EXEEXT): mksymbian.pas
+#
+#   Makefile.fpc for Free Pascal Symbian Build Tool
+#
+
+[target]
+programs=mksymbian
+
+[clean]
+units=cfgfile cmdline compiler constants projectparser sdkutil
+
+[require]
+packages=
+
+[compiler]
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[rules]
+.NOTPARALLEL:
+mksymbian$(EXEEXT): mksymbian.pas

+ 37 - 37
utils/mksymbian/cfgfile.pas

@@ -1,37 +1,37 @@
-{
-cfgfile.pas
-
-Config file methods
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit cfgfile;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils; 
-
-implementation
-
-end.
-
+{
+cfgfile.pas
+
+Config file methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit cfgfile;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+implementation
+
+end.
+

+ 139 - 139
utils/mksymbian/cmdline.pas

@@ -1,139 +1,139 @@
-{
-cmdline.pas
-
-Command line parsing methods
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit cmdline;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils,
-  constants;
-
-type
-
-  { TCmdLine }
-
-  TCmdLine = class(TObject)
-  public
-    procedure Usage;
-    procedure ShowPath;
-    procedure ParseCmdLineOptions(var opts: TMkSymbianOptions);
-  end;
-  
-var
-  vCmdLine: TCmdLine;
-
-implementation
-
-uses sdkutil, projectparser;
-
-{ TCmdLine }
-
-{*******************************************************************
-*  TCmdLine.Usage ()
-*
-*  DESCRIPTION:    Shows a usage message for the tool
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCmdLine.Usage;
-begin
-  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
-  WriteLn('');
-  WriteLn('The parameters you specifyed are wrong.');
-  WriteLn('');
-  WriteLn('Usage: mksymbian [command] [project file]');
-  WriteLn('');
-  WriteLn('Possible commands: ');
-  WriteLn('');
-  WriteLn('build    - Builds an application');
-  WriteLn('bindings - Builds the c++ bindings for pascal');
-  WriteLn('showpath - Show the paths the tool is using');
-  WriteLn('');
-end;
-
-{*******************************************************************
-*  TCmdLine.ShowPath ()
-*
-*  DESCRIPTION:    Shows in which paths (sdk, fpc, etc) mksymbian is using
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCmdLine.ShowPath;
-begin
-  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
-  WriteLn('');
-  WriteLn('SDK Version: ' + vSDKUtil.StrSDKVersion);
-  WriteLn('Location of SDK: ' + vSDKUtil.SDKFolder);
-  WriteLn('Location of Free Pascal Compiler: ' + vProject.CompilerPath);
-  WriteLn('');
-end;
-
-{*******************************************************************
-*  TCmdLine.ParseCmdLineOptions ()
-*
-*  DESCRIPTION:    Parses the command line options utilized to call mksymbian
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCmdLine.ParseCmdLineOptions(var opts: TMkSymbianOptions);
-begin
-  FillChar(opts, SizeOf(TMkSymbianOptions), #0);
-
-  if (ParamCount = 0) then
-  begin
-    Usage;
-    Exit;
-  end;
-
-  opts.ProjectFile := ParamStr(2);
-
-  if CompareText(ParamStr(1), paramBuild) = 0 then opts.task := stBuildApp
-  else if CompareText(ParamStr(1), paramBindings) = 0 then opts.task := stBuildBindings
-  else if CompareText(ParamStr(1), paramShowPath) = 0 then
-  begin
-    opts.task := stNothing;
-    vProject.ParseFile;
-    ShowPath;
-  end
-  else
-  begin
-    opts.task := stNothing;
-    Usage;
-  end;
-end;
-
-end.
-
+{
+cmdline.pas
+
+Command line parsing methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit cmdline;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils,
+  constants;
+
+type
+
+  { TCmdLine }
+
+  TCmdLine = class(TObject)
+  public
+    procedure Usage;
+    procedure ShowPath;
+    procedure ParseCmdLineOptions(var opts: TMkSymbianOptions);
+  end;
+  
+var
+  vCmdLine: TCmdLine;
+
+implementation
+
+uses sdkutil, projectparser;
+
+{ TCmdLine }
+
+{*******************************************************************
+*  TCmdLine.Usage ()
+*
+*  DESCRIPTION:    Shows a usage message for the tool
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.Usage;
+begin
+  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
+  WriteLn('');
+  WriteLn('The parameters you specifyed are wrong.');
+  WriteLn('');
+  WriteLn('Usage: mksymbian [command] [project file]');
+  WriteLn('');
+  WriteLn('Possible commands: ');
+  WriteLn('');
+  WriteLn('build    - Builds an application');
+  WriteLn('bindings - Builds the c++ bindings for pascal');
+  WriteLn('showpath - Show the paths the tool is using');
+  WriteLn('');
+end;
+
+{*******************************************************************
+*  TCmdLine.ShowPath ()
+*
+*  DESCRIPTION:    Shows in which paths (sdk, fpc, etc) mksymbian is using
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.ShowPath;
+begin
+  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
+  WriteLn('');
+  WriteLn('SDK Version: ' + vSDKUtil.StrSDKVersion);
+  WriteLn('Location of SDK: ' + vSDKUtil.SDKFolder);
+  WriteLn('Location of Free Pascal Compiler: ' + vProject.CompilerPath);
+  WriteLn('');
+end;
+
+{*******************************************************************
+*  TCmdLine.ParseCmdLineOptions ()
+*
+*  DESCRIPTION:    Parses the command line options utilized to call mksymbian
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.ParseCmdLineOptions(var opts: TMkSymbianOptions);
+begin
+  FillChar(opts, SizeOf(TMkSymbianOptions), #0);
+
+  if (ParamCount = 0) then
+  begin
+    Usage;
+    Exit;
+  end;
+
+  opts.ProjectFile := ParamStr(2);
+
+  if CompareText(ParamStr(1), paramBuild) = 0 then opts.task := stBuildApp
+  else if CompareText(ParamStr(1), paramBindings) = 0 then opts.task := stBuildBindings
+  else if CompareText(ParamStr(1), paramShowPath) = 0 then
+  begin
+    opts.task := stNothing;
+    vProject.ParseFile;
+    ShowPath;
+  end
+  else
+  begin
+    opts.task := stNothing;
+    Usage;
+  end;
+end;
+
+end.
+

+ 652 - 652
utils/mksymbian/compiler.pas

@@ -1,652 +1,652 @@
-{
-compiler.pas
-
-Compiling, Linking and Registering in Emulator methods
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit compiler;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils, Process,
-  constants;
-
-type
-
-  { TCompiler }
-
-  TCompiler = class(TObject)
-  private
-    AProcess: TProcess;
-    CurrentDirectory: string;
-    MakeFolder, MakePartialFolder, BindingsUnitsFolder: string;
-  public
-    opts: TMkSymbianOptions;
-    constructor Create;
-    destructor Destroy; override;
-    procedure FileCopy(source, dest: string);
-    procedure MakeBuildPascal;
-    procedure MakeBuildPascal_UIQ21_ARM;
-    procedure MakeBuildPascal_UIQ3_Emulator;
-    procedure MakeBuildCpp;
-    procedure MakeBuildBindings;
-    procedure BuildUIDFile;
-    procedure BuildResource(AFileName: string);
-    procedure InstallResource(AFileName: string);
-    procedure RegisterInEmulator;
-  end;
-
-var
-  vCompiler: TCompiler;
-
-implementation
-
-uses sdkutil, projectparser;
-
-{ TCompiler }
-
-{*******************************************************************
-*  TCompiler.Create ()
-*
-*  DESCRIPTION:    Initializes the compiler controlling object
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-constructor TCompiler.Create;
-begin
-  inherited Create;
-
-  AProcess := TProcess.Create(nil);
-
-  CurrentDirectory := ExtractFilePath(ParamStr(0));
-  MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2);
-  MakeFolder := IncludeTrailingBackslash(CurrentDirectory);
-  
-  { When compiling the bindings we use a relative directory to get the output dir }
-  BindingsUnitsFolder := MakeFolder + '../../units/i386-symbian/';
-
-  AProcess.Options := AProcess.Options + [poWaitOnExit];
-end;
-
-{*******************************************************************
-*  TCompiler.Destroy ()
-*
-*  DESCRIPTION:    Finalizes the compiler controlling object
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-destructor TCompiler.Destroy;
-begin
-  AProcess.Free;
-
-  inherited Destroy;
-end;
-
-{*******************************************************************
-*  TCompiler.FileCopy ()
-*
-*  DESCRIPTION:    Copyes a file from source to dest
-*
-*  PARAMETERS:     source  - Source file
-*                  dest    - Destination file
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.FileCopy(source, dest: string);
-var
-  SourceStream, DestStream: TFileStream;
-begin
-  WriteLn('');
-  WriteLn('Copying file: ', source);
-  WriteLn('To: ', dest);
-  WriteLn('');
-
-  SourceStream := TFileStream.Create(source, fmOpenRead);
-  try
-    DestStream := TFileStream.Create(dest, fmCreate);
-    try
-      DestStream.CopyFrom(SourceStream, 0);
-    finally
-      DestStream.Free;
-    end;
-  finally
-    SourceStream.Free;
-  end;
-end;
-
-{*******************************************************************
-*  TCompiler.MakeBuildPascal ()
-*
-*  DESCRIPTION:    Builds and links a Object Pascal project
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.MakeBuildPascal;
-begin
-  case vSDKUtil.SDKVersion of
-   sdkUIQ21: MakeBuildPascal_UIQ21_ARM;
-   sdkUIQ3:  MakeBuildPascal_UIQ3_Emulator;
-  end;
-end;
-
-procedure TCompiler.MakeBuildPascal_UIQ21_ARM;
-var
-  EPOCSTATLINKUREL, EPOCLINKUREL, LIBSUREL: string;
-begin
-  WriteLn('');
-  WriteLn('Preparations for compiling');
-  WriteLn('');
-
-  { Creation of directories }
-
-  { Compiling the source files }
-
-  WriteLn('');
-  WriteLn('Compiling file ' + vProject.MainSource);
-  WriteLn('');
-
-  AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
-    ' -Tsymbian ' + vProject.MainSource;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  WriteLn('');
-  WriteLn('Assembling file '+ vProject.MainSourceAsm);
-  WriteLn('');
-
-  AProcess.CommandLine := vProject.AssemblerPath + ' ' +
-   vProject.MainSourceAsm + ' -o ' + vProject.MainSourceObj;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  { Linking and library creation }
-  
-  WriteLn('');
-  WriteLn('Linking and library creation');
-  WriteLn('');
-
-  EPOCSTATLINKUREL := vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\THUMB\UREL\';
-  EPOCLINKUREL := vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\THUMB\UREL\';
-
-  LIBSUREL := EPOCSTATLINKUREL + 'EDLLSTUB.LIB '
-    + EPOCSTATLINKUREL + 'EGCC.LIB '
-    + EPOCLINKUREL + 'EUSER.LIB '
-    + EPOCLINKUREL + 'APPARC.LIB '
-    + EPOCLINKUREL + 'CONE.LIB '
-    + EPOCLINKUREL + 'EIKCORE.LIB '
-    + EPOCLINKUREL + 'EIKCOCTL.LIB ';
-
-  AProcess.CommandLine := 'dlltool -m thumb '
-   + '--output-def "' + MakePartialFolder + 'HELLOWORLD.inf" "'
-   + MakePartialFolder + 'HELLOWORLD.in" ';
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-  AProcess.CommandLine := 'perl -S ' + vSdkUtil.SDKFolder + Str_Path_UIQ2_Makmake
-   + ' -Deffile "' + MakePartialFolder + 'HELLOWORLD.inf" -1 NewApplication__Fv "'
-   + MakePartialFolder + 'HELLOWORLD.dev"';
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-{ -$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.inf" }
-
-  AProcess.CommandLine := 'dlltool -m thumb --def "'
-   + MakePartialFolder + 'HELLOWORLD.def" --output-exp "'
-   + MakePartialFolder + 'HELLOWORLD.exp" --dllname "HELLOWORLD[101f6163].APP"';
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-  AProcess.CommandLine := 'ld  -s --thumb-entry _E32Dll '
-   + '-u _E32Dll "' + MakePartialFolder + 'HELLOWORLD.exp" '
-   + '--dll --base-file "' + MakePartialFolder + 'HELLOWORLD.bas" '
-   + '-o "' + MakePartialFolder + 'HELLOWORLD.APP" "'
-   + EPOCSTATLINKUREL + 'EDLL.LIB" '
-   + '--whole-archive "' + MakePartialFolder + 'HELLOWORLD.in" '
-   + '--no-whole-archive ' + LIBSUREL;
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-{	-$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.exp"
-	-$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.APP"
- }
-
-  AProcess.CommandLine := 'dlltool -m thumb '
-   + '--def "' + MakePartialFolder + 'HELLOWORLD.def" '
-   + '--dllname "HELLOWORLD[101f6163].APP" '
-   + '--base-file "' + MakePartialFolder + 'HELLOWORLD.bas" '
-   + '--output-exp ' + MakePartialFolder + 'HELLOWORLD.exp"';
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-  AProcess.CommandLine := 'ld  -s --thumb-entry _E32Dll -u _E32Dll --dll "'
-   + MakePartialFolder + 'HELLOWORLD.exp" -Map "'
-   + MakePartialFolder + 'HELLOWORLD.APP.map" -o "'
-   + MakePartialFolder + 'HELLOWORLD.APP" "'
-   + EPOCSTATLINKUREL + 'EDLL.LIB" --whole-archive "'
-   + MakePartialFolder + 'HELLOWORLD.in" --no-whole-archive '
-   + LIBSUREL;
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-
-  AProcess.CommandLine := 'petran  "'
-   + MakePartialFolder + 'HELLOWORLD.APP" "'
-   + MakePartialFolder + 'HELLOWORLD.APP" '
-   + '-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x101f6163';
-  WriteLn('');
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  AProcess.Execute;
-end;
-
-procedure TCompiler.MakeBuildPascal_UIQ3_Emulator;
-var
-  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string;
-  STR_FPC_RTL_OBJECTS: string;
-  i: Integer;
-begin
-
-  WriteLn('');
-  WriteLn('Preparations for compiling');
-  WriteLn('');
-
-  // First command
-
-{  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;}
-
-  { Creation of directories }
-
-  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
-
-  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
-
-  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
-
-  { Compilation }
-
-  WriteLn('');
-  WriteLn('Compiling file ' + vProject.MainSource);
-  WriteLn('');
-
-  AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
-    ' -Tsymbian ' + vProject.MainSource;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  WriteLn('');
-  WriteLn('Assembling file '+ vProject.MainSourceAsm);
-  WriteLn('');
-
-  AProcess.CommandLine := vProject.AssemblerPath + ' ' +
-   vProject.MainSourceAsm + ' -o ' + vProject.MainSourceObj;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  { UID File }
-
-  BuildUIDFile;
-
-  { Linking }
-
-  STR_LINK_FLAGSUDEB := '-msgstyle gcc -stdlib "' +
-    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB" -m' +
-    ' "?_E32Bootstrap@@YGXXZ" -subsystem windows -g ' +
-    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' +
-    '-o "' + MakeFolder + 'QPasHello.exe" -noimplib';
-  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
-
-  STR_LINK_OBJSUDEB :=
-    ' ' + MakeFolder + UID_OBJECT_FILENAME;
-
-  for i := 0 to vProject.ObjectFiles.Count - 1 do
-   STR_LINK_OBJSUDEB := STR_LINK_OBJSUDEB +
-    ' ' + MakeFolder + vProject.ObjectFiles.Strings[i];
-
-  STR_FPC_RTL_OBJECTS :=
-    ' ' + vProject.RTLUnitsDir + 'system.o' +
-    ' ' + vProject.RTLUnitsDir + 'symbian.o' +
-    ' ' + vProject.RTLUnitsDir + 'ctypes.o' +
-    ' ' + vProject.RTLUnitsDir + 'objpas.o' +
-    ' ' + vProject.RTLUnitsDir + 'pbeexe.o';
-
-  WriteLn('');
-  WriteLn('Linking stage');
-  WriteLn('');
-
-  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools +
-    'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
-    ' -l ' + MakeFolder +
-    ' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  FileCopy(MakeFolder + 'QPasHello.exe',
-   vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + 'QPasHello.exe');
-end;
-
-{*******************************************************************
-*  TCompiler.MakeBuildCpp ()
-*
-*  DESCRIPTION:    Builds and links a C++ project
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.MakeBuildCpp;
-var
-  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB,
-  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB: string;
-begin
-
-  WriteLn('');
-  WriteLn('Preparations for compiling');
-  WriteLn('');
-  
-  // First command
-
-  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  { Creation of directories }
-
-  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
-
-  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
-
-  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
-
-//  TODO: Check if this can be safely removed
-//  ForceDirectories(MakeFolder + 'QHelloWorld\WINSCW');
-
-  { Compilation }
-
-  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
-    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
-  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
-  STR_INCDIR := '-cwd source -i- ' +
-    '-i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
-    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
-    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ " ' +
-    '-include "UIQ_3.0.hrh"';
-  STR_CWUDEB := 'mwccsym2.exe -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
-
-  WriteLn('');
-  WriteLn('Compiling file ' + vProject.MainSource);
-  WriteLn('');
-
-  AProcess.CommandLine := STR_CWUDEB +
-    ' -o "' + MakeFolder + 'WINSCW\UDEB\' + vProject.MainSourceNoExt + '.o"' +
-    ' -c "' + MakeFolder + 'src\' + vProject.MainSource + '"';
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  { UID File }
-
-  BuildUIDFile;
-
-  { Linking }
-
-  STR_LINK_FLAGSUDEB := '-msgstyle gcc' +
-    ' -stdlib "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB"' +
-    ' -m "?_E32Bootstrap@@YGXXZ" -subsystem windows' +
-    ' -g ' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB' +
-    ' -o "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + vProject.MainSourceNoExt + '.exe"' +
-    ' -noimplib';
-  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
-  STR_LINK_OBJSUDEB := vProject.MainSourceNoExt + '.o ' + UID_OBJECT_FILENAME;
-
-  WriteLn('');
-  WriteLn('Linking stage');
-  WriteLn('');
-
-  AProcess.CommandLine := 'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
-    ' -l ' + STR_EPOCBLDUDEB +
-    ' -search ' + STR_LINK_OBJSUDEB;
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-end;
-
-{*******************************************************************
-*  TCompiler.MakeBuildBindings ()
-*
-*  DESCRIPTION:    Builds and links the C interface for the symbian libraries
-*
-*                  Note the we use a output directory relative to the current directory
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.MakeBuildBindings;
-var
-  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
-begin
-  { Makes sure that the output directory exists }
-
-  SysUtils.ForceDirectories(BindingsUnitsFolder);
-  
-  { Compilation }
-
-  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
-    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
-  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
-  STR_INCDIR := '-cwd source -i-' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include"' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant"' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
-    ' -include "UIQ_3.0.hrh"';
-  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
-  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
-
-  WriteLn('');
-  WriteLn('Compiling file pbeexe.cpp');
-  WriteLn('');
-
-  AProcess.CommandLine := STR_CWUDEB +
-    ' -o "' + BindingsUnitsFolder + 'pbeexe.o" ' +
-    '-c "' + MakePartialFolder + 'pbeexe.cpp"';
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-end;
-
-{*******************************************************************
-*  TCompiler.BuildUIDFile ()
-*
-*  DESCRIPTION:    Generates and compiles a UID file
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.BuildUIDFile;
-var
-  Str_UIDFile: string;
-  UIDFile: TFileStream;
-  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
-begin
-  { First creates the UID file }
-
-  WriteLn('');
-  WriteLn('Creating UID file');
-  WriteLn('');
-
-  Str_UIDFile :=
-    '// mksymbian-generated uid source file' + LineEnding +
-    '#include <e32cmn.h>' + LineEnding +
-    '#pragma data_seg(".SYMBIAN")' + LineEnding +
-    '__EMULATOR_IMAGE_HEADER2(0x1000007a,' + vProject.UID2 + ',' + vProject.UID3 +
-   ',EPriorityForeground,0x00000000u,0x00000000u,0x01000001,0,0x00010000,0)' + LineEnding +
-    '#pragma data_seg()' + LineEnding;
-
-  UIDFile := TFileStream.Create(UID_SOURCE_FILENAME, fmCreate);
-  try
-    UIDFile.Write(Pointer(Str_UIDFile)^, Length(Str_UIDFile));
-  finally
-    UIDFile.Free;
-  end;
-  
-  { Compilation }
-
-  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
-    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
-  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
-  STR_INCDIR := '-cwd source -i- ' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
-    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
-    ' -include "UIQ_3.0.hrh"';
-  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
-  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
-
-  WriteLn('');
-  WriteLn('Compiling file ' + UID_SOURCE_FILENAME);
-  WriteLn('');
-
-  AProcess.CommandLine := STR_CWUDEB +
-    ' -o "' + MakeFolder + UID_OBJECT_FILENAME + '"' +
-    ' -c "' + MakeFolder + UID_SOURCE_FILENAME + '"';
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-end;
-
-{*******************************************************************
-*  TCompiler.BuildResource ()
-*
-*  DESCRIPTION:    Builds a resource file
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.BuildResource(AFileName: string);
-begin
-  WriteLn('');
-  WriteLn('Preprocessing resource file: ' + AFileName);
-  WriteLn('');
-
-  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_Cpp +
-    ' -lang-c++' +
-    ' -I ' + vSDKUtil.SDKPartialFolder + 'EPOC32\include' +
-    ' -I ' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant' +
-    ' ' + MakeFolder + AFileName +
-    ' ' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT);
-  WriteLn(AProcess.CommandLine);
-  AProcess.Execute;
-
-  WriteLn('');
-  WriteLn('Building resource file: ' + AFileName);
-  WriteLn('');
-
-  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_RComp +
-    ' -v -u' +
-    ' -o"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_EXT) + '"' +
-    ' -s"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT) + '"';
-  WriteLn(AProcess.CommandLine);
-  WriteLn('');
-  System.Flush(System.StdOut);
-  AProcess.Execute;
-end;
-
-{*******************************************************************
-*  TCompiler.InstallResource ()
-*
-*  DESCRIPTION:    Install a resource file
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.InstallResource(AFileName: string);
-var
-  StrFrom, StrTo: string;
-begin
-  WriteLn('');
-  WriteLn('Installing resource file: ', AFileName);
-  WriteLn('');
-
-  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
-  StrTo := vSDKUtil.SDKFolder + Str_Path_Resource_Files +
-   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
-
-  FileCopy(StrFrom, StrTo);
-end;
-
-{*******************************************************************
-*  TCompiler.RegisterInEmulator ()
-*
-*  DESCRIPTION:    Registers a software in the emulator
-*                  At this point the resource file must already be compiled
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TCompiler.RegisterInEmulator;
-var
-  StrFrom, StrTo: string;
-begin
-  WriteLn('');
-  WriteLn('Registering the software on the emulator');
-  WriteLn('');
-
-  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
-  StrTo := vSDKUtil.SDKFolder + Str_Path_Emulator_Registration +
-   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
-
-  FileCopy(StrFrom, StrTo);
-end;
-
-end.
-
+{
+compiler.pas
+
+Compiling, Linking and Registering in Emulator methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit compiler;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, Process,
+  constants;
+
+type
+
+  { TCompiler }
+
+  TCompiler = class(TObject)
+  private
+    AProcess: TProcess;
+    CurrentDirectory: string;
+    MakeFolder, MakePartialFolder, BindingsUnitsFolder: string;
+  public
+    opts: TMkSymbianOptions;
+    constructor Create;
+    destructor Destroy; override;
+    procedure FileCopy(source, dest: string);
+    procedure MakeBuildPascal;
+    procedure MakeBuildPascal_UIQ21_ARM;
+    procedure MakeBuildPascal_UIQ3_Emulator;
+    procedure MakeBuildCpp;
+    procedure MakeBuildBindings;
+    procedure BuildUIDFile;
+    procedure BuildResource(AFileName: string);
+    procedure InstallResource(AFileName: string);
+    procedure RegisterInEmulator;
+  end;
+
+var
+  vCompiler: TCompiler;
+
+implementation
+
+uses sdkutil, projectparser;
+
+{ TCompiler }
+
+{*******************************************************************
+*  TCompiler.Create ()
+*
+*  DESCRIPTION:    Initializes the compiler controlling object
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+constructor TCompiler.Create;
+begin
+  inherited Create;
+
+  AProcess := TProcess.Create(nil);
+
+  CurrentDirectory := ExtractFilePath(ParamStr(0));
+  MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2);
+  MakeFolder := IncludeTrailingBackslash(CurrentDirectory);
+  
+  { When compiling the bindings we use a relative directory to get the output dir }
+  BindingsUnitsFolder := MakeFolder + '../../units/i386-symbian/';
+
+  AProcess.Options := AProcess.Options + [poWaitOnExit];
+end;
+
+{*******************************************************************
+*  TCompiler.Destroy ()
+*
+*  DESCRIPTION:    Finalizes the compiler controlling object
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+destructor TCompiler.Destroy;
+begin
+  AProcess.Free;
+
+  inherited Destroy;
+end;
+
+{*******************************************************************
+*  TCompiler.FileCopy ()
+*
+*  DESCRIPTION:    Copyes a file from source to dest
+*
+*  PARAMETERS:     source  - Source file
+*                  dest    - Destination file
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.FileCopy(source, dest: string);
+var
+  SourceStream, DestStream: TFileStream;
+begin
+  WriteLn('');
+  WriteLn('Copying file: ', source);
+  WriteLn('To: ', dest);
+  WriteLn('');
+
+  SourceStream := TFileStream.Create(source, fmOpenRead);
+  try
+    DestStream := TFileStream.Create(dest, fmCreate);
+    try
+      DestStream.CopyFrom(SourceStream, 0);
+    finally
+      DestStream.Free;
+    end;
+  finally
+    SourceStream.Free;
+  end;
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildPascal ()
+*
+*  DESCRIPTION:    Builds and links a Object Pascal project
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildPascal;
+begin
+  case vSDKUtil.SDKVersion of
+   sdkUIQ21: MakeBuildPascal_UIQ21_ARM;
+   sdkUIQ3:  MakeBuildPascal_UIQ3_Emulator;
+  end;
+end;
+
+procedure TCompiler.MakeBuildPascal_UIQ21_ARM;
+var
+  EPOCSTATLINKUREL, EPOCLINKUREL, LIBSUREL: string;
+begin
+  WriteLn('');
+  WriteLn('Preparations for compiling');
+  WriteLn('');
+
+  { Creation of directories }
+
+  { Compiling the source files }
+
+  WriteLn('');
+  WriteLn('Compiling file ' + vProject.MainSource);
+  WriteLn('');
+
+  AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
+    ' -Tsymbian ' + vProject.MainSource;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  WriteLn('');
+  WriteLn('Assembling file '+ vProject.MainSourceAsm);
+  WriteLn('');
+
+  AProcess.CommandLine := vProject.AssemblerPath + ' ' +
+   vProject.MainSourceAsm + ' -o ' + vProject.MainSourceObj;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { Linking and library creation }
+  
+  WriteLn('');
+  WriteLn('Linking and library creation');
+  WriteLn('');
+
+  EPOCSTATLINKUREL := vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\THUMB\UREL\';
+  EPOCLINKUREL := vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\THUMB\UREL\';
+
+  LIBSUREL := EPOCSTATLINKUREL + 'EDLLSTUB.LIB '
+    + EPOCSTATLINKUREL + 'EGCC.LIB '
+    + EPOCLINKUREL + 'EUSER.LIB '
+    + EPOCLINKUREL + 'APPARC.LIB '
+    + EPOCLINKUREL + 'CONE.LIB '
+    + EPOCLINKUREL + 'EIKCORE.LIB '
+    + EPOCLINKUREL + 'EIKCOCTL.LIB ';
+
+  AProcess.CommandLine := 'dlltool -m thumb '
+   + '--output-def "' + MakePartialFolder + 'HELLOWORLD.inf" "'
+   + MakePartialFolder + 'HELLOWORLD.in" ';
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+  AProcess.CommandLine := 'perl -S ' + vSdkUtil.SDKFolder + Str_Path_UIQ2_Makmake
+   + ' -Deffile "' + MakePartialFolder + 'HELLOWORLD.inf" -1 NewApplication__Fv "'
+   + MakePartialFolder + 'HELLOWORLD.dev"';
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+{ -$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.inf" }
+
+  AProcess.CommandLine := 'dlltool -m thumb --def "'
+   + MakePartialFolder + 'HELLOWORLD.def" --output-exp "'
+   + MakePartialFolder + 'HELLOWORLD.exp" --dllname "HELLOWORLD[101f6163].APP"';
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+  AProcess.CommandLine := 'ld  -s --thumb-entry _E32Dll '
+   + '-u _E32Dll "' + MakePartialFolder + 'HELLOWORLD.exp" '
+   + '--dll --base-file "' + MakePartialFolder + 'HELLOWORLD.bas" '
+   + '-o "' + MakePartialFolder + 'HELLOWORLD.APP" "'
+   + EPOCSTATLINKUREL + 'EDLL.LIB" '
+   + '--whole-archive "' + MakePartialFolder + 'HELLOWORLD.in" '
+   + '--no-whole-archive ' + LIBSUREL;
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+{	-$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.exp"
+	-$(ERASE) "$(EPOCBLDUREL)\HELLOWORLD.APP"
+ }
+
+  AProcess.CommandLine := 'dlltool -m thumb '
+   + '--def "' + MakePartialFolder + 'HELLOWORLD.def" '
+   + '--dllname "HELLOWORLD[101f6163].APP" '
+   + '--base-file "' + MakePartialFolder + 'HELLOWORLD.bas" '
+   + '--output-exp ' + MakePartialFolder + 'HELLOWORLD.exp"';
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+  AProcess.CommandLine := 'ld  -s --thumb-entry _E32Dll -u _E32Dll --dll "'
+   + MakePartialFolder + 'HELLOWORLD.exp" -Map "'
+   + MakePartialFolder + 'HELLOWORLD.APP.map" -o "'
+   + MakePartialFolder + 'HELLOWORLD.APP" "'
+   + EPOCSTATLINKUREL + 'EDLL.LIB" --whole-archive "'
+   + MakePartialFolder + 'HELLOWORLD.in" --no-whole-archive '
+   + LIBSUREL;
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+
+  AProcess.CommandLine := 'petran  "'
+   + MakePartialFolder + 'HELLOWORLD.APP" "'
+   + MakePartialFolder + 'HELLOWORLD.APP" '
+   + '-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x101f6163';
+  WriteLn('');
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  AProcess.Execute;
+end;
+
+procedure TCompiler.MakeBuildPascal_UIQ3_Emulator;
+var
+  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string;
+  STR_FPC_RTL_OBJECTS: string;
+  i: Integer;
+begin
+
+  WriteLn('');
+  WriteLn('Preparations for compiling');
+  WriteLn('');
+
+  // First command
+
+{  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;}
+
+  { Creation of directories }
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
+
+  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
+
+  { Compilation }
+
+  WriteLn('');
+  WriteLn('Compiling file ' + vProject.MainSource);
+  WriteLn('');
+
+  AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
+    ' -Tsymbian ' + vProject.MainSource;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  WriteLn('');
+  WriteLn('Assembling file '+ vProject.MainSourceAsm);
+  WriteLn('');
+
+  AProcess.CommandLine := vProject.AssemblerPath + ' ' +
+   vProject.MainSourceAsm + ' -o ' + vProject.MainSourceObj;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { UID File }
+
+  BuildUIDFile;
+
+  { Linking }
+
+  STR_LINK_FLAGSUDEB := '-msgstyle gcc -stdlib "' +
+    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB" -m' +
+    ' "?_E32Bootstrap@@YGXXZ" -subsystem windows -g ' +
+    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' +
+    '-o "' + MakeFolder + 'QPasHello.exe" -noimplib';
+  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
+
+  STR_LINK_OBJSUDEB :=
+    ' ' + MakeFolder + UID_OBJECT_FILENAME;
+
+  for i := 0 to vProject.ObjectFiles.Count - 1 do
+   STR_LINK_OBJSUDEB := STR_LINK_OBJSUDEB +
+    ' ' + MakeFolder + vProject.ObjectFiles.Strings[i];
+
+  STR_FPC_RTL_OBJECTS :=
+    ' ' + vProject.RTLUnitsDir + 'system.o' +
+    ' ' + vProject.RTLUnitsDir + 'symbian.o' +
+    ' ' + vProject.RTLUnitsDir + 'ctypes.o' +
+    ' ' + vProject.RTLUnitsDir + 'objpas.o' +
+    ' ' + vProject.RTLUnitsDir + 'pbeexe.o';
+
+  WriteLn('');
+  WriteLn('Linking stage');
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools +
+    'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
+    ' -l ' + MakeFolder +
+    ' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  FileCopy(MakeFolder + 'QPasHello.exe',
+   vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + 'QPasHello.exe');
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildCpp ()
+*
+*  DESCRIPTION:    Builds and links a C++ project
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildCpp;
+var
+  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB,
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB: string;
+begin
+
+  WriteLn('');
+  WriteLn('Preparations for compiling');
+  WriteLn('');
+  
+  // First command
+
+  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { Creation of directories }
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
+
+  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
+
+//  TODO: Check if this can be safely removed
+//  ForceDirectories(MakeFolder + 'QHelloWorld\WINSCW');
+
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i- ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ " ' +
+    '-include "UIQ_3.0.hrh"';
+  STR_CWUDEB := 'mwccsym2.exe -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file ' + vProject.MainSource);
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + MakeFolder + 'WINSCW\UDEB\' + vProject.MainSourceNoExt + '.o"' +
+    ' -c "' + MakeFolder + 'src\' + vProject.MainSource + '"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { UID File }
+
+  BuildUIDFile;
+
+  { Linking }
+
+  STR_LINK_FLAGSUDEB := '-msgstyle gcc' +
+    ' -stdlib "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB"' +
+    ' -m "?_E32Bootstrap@@YGXXZ" -subsystem windows' +
+    ' -g ' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB' +
+    ' -o "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + vProject.MainSourceNoExt + '.exe"' +
+    ' -noimplib';
+  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
+  STR_LINK_OBJSUDEB := vProject.MainSourceNoExt + '.o ' + UID_OBJECT_FILENAME;
+
+  WriteLn('');
+  WriteLn('Linking stage');
+  WriteLn('');
+
+  AProcess.CommandLine := 'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
+    ' -l ' + STR_EPOCBLDUDEB +
+    ' -search ' + STR_LINK_OBJSUDEB;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildBindings ()
+*
+*  DESCRIPTION:    Builds and links the C interface for the symbian libraries
+*
+*                  Note the we use a output directory relative to the current directory
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildBindings;
+var
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
+begin
+  { Makes sure that the output directory exists }
+
+  SysUtils.ForceDirectories(BindingsUnitsFolder);
+  
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i-' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include"' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant"' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
+    ' -include "UIQ_3.0.hrh"';
+  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
+  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file pbeexe.cpp');
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + BindingsUnitsFolder + 'pbeexe.o" ' +
+    '-c "' + MakePartialFolder + 'pbeexe.cpp"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.BuildUIDFile ()
+*
+*  DESCRIPTION:    Generates and compiles a UID file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.BuildUIDFile;
+var
+  Str_UIDFile: string;
+  UIDFile: TFileStream;
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
+begin
+  { First creates the UID file }
+
+  WriteLn('');
+  WriteLn('Creating UID file');
+  WriteLn('');
+
+  Str_UIDFile :=
+    '// mksymbian-generated uid source file' + LineEnding +
+    '#include <e32cmn.h>' + LineEnding +
+    '#pragma data_seg(".SYMBIAN")' + LineEnding +
+    '__EMULATOR_IMAGE_HEADER2(0x1000007a,' + vProject.UID2 + ',' + vProject.UID3 +
+   ',EPriorityForeground,0x00000000u,0x00000000u,0x01000001,0,0x00010000,0)' + LineEnding +
+    '#pragma data_seg()' + LineEnding;
+
+  UIDFile := TFileStream.Create(UID_SOURCE_FILENAME, fmCreate);
+  try
+    UIDFile.Write(Pointer(Str_UIDFile)^, Length(Str_UIDFile));
+  finally
+    UIDFile.Free;
+  end;
+  
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i- ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
+    ' -include "UIQ_3.0.hrh"';
+  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
+  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file ' + UID_SOURCE_FILENAME);
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + MakeFolder + UID_OBJECT_FILENAME + '"' +
+    ' -c "' + MakeFolder + UID_SOURCE_FILENAME + '"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.BuildResource ()
+*
+*  DESCRIPTION:    Builds a resource file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.BuildResource(AFileName: string);
+begin
+  WriteLn('');
+  WriteLn('Preprocessing resource file: ' + AFileName);
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_Cpp +
+    ' -lang-c++' +
+    ' -I ' + vSDKUtil.SDKPartialFolder + 'EPOC32\include' +
+    ' -I ' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant' +
+    ' ' + MakeFolder + AFileName +
+    ' ' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT);
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  WriteLn('');
+  WriteLn('Building resource file: ' + AFileName);
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_RComp +
+    ' -v -u' +
+    ' -o"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_EXT) + '"' +
+    ' -s"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT) + '"';
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  System.Flush(System.StdOut);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.InstallResource ()
+*
+*  DESCRIPTION:    Install a resource file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.InstallResource(AFileName: string);
+var
+  StrFrom, StrTo: string;
+begin
+  WriteLn('');
+  WriteLn('Installing resource file: ', AFileName);
+  WriteLn('');
+
+  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+  StrTo := vSDKUtil.SDKFolder + Str_Path_Resource_Files +
+   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+
+  FileCopy(StrFrom, StrTo);
+end;
+
+{*******************************************************************
+*  TCompiler.RegisterInEmulator ()
+*
+*  DESCRIPTION:    Registers a software in the emulator
+*                  At this point the resource file must already be compiled
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.RegisterInEmulator;
+var
+  StrFrom, StrTo: string;
+begin
+  WriteLn('');
+  WriteLn('Registering the software on the emulator');
+  WriteLn('');
+
+  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+  StrTo := vSDKUtil.SDKFolder + Str_Path_Emulator_Registration +
+   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+
+  FileCopy(StrFrom, StrTo);
+end;
+
+end.
+

+ 124 - 124
utils/mksymbian/constants.pas

@@ -1,124 +1,124 @@
-{
-constants.pas
-
-Constants
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit constants;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils; 
-
-type
-
-  { Options from the command line }
-
-  TMkSymbianTask = (stNothing, stBuildApp, stBuildBindings);
-
-  TMkSymbianOptions = record
-    Task: TMkSymbianTask;
-    ProjectFile: string;
-  end;
-
-{ Constants and types for the SDK version }
-type
-  TSDKVersion = (sdkUIQ21, sdkUIQ3);
-
-const
-  Str_UIQ21 = 'UIQ 2.1';
-  Str_UIQ3  = 'UIQ 3';
-
-{ Commands }
-
-const
-  paramBuild = 'build';
-  paramBindings = 'bindings';
-  paramShowPath = 'showpath';
-
-{ Paths on the SDK }
-const
-  { UIQ 2 Paths }
-  Str_Path_UIQ2_ARM_BINUTILS = 'epoc32\gcc\bin\';
-  Str_Path_UIQ2_Makmake = 'epoc32\tools\makmake.pl';
-
-  { UIQ 3 Paths }
-  Str_Path_CWTools = 'epoc32\tools\nokia_compiler\Symbian_Tools\Command_Line_Tools\';
-  Str_Path_RComp = 'epoc32\tools\rcomp.exe';
-  Str_Path_Cpp = 'epoc32\tools\scpp.exe';
-  Str_Path_Resource_Files = 'epoc32\release\winscw\udeb\Z\resource\apps\';
-  Str_Path_Emulator_Registration = 'epoc32\release\winscw\udeb\Z\private\10003a3f\apps\';
-
-{ Other constants }
-const
-  UID_SOURCE_FILENAME = 'QUID.cpp';
-  UID_OBJECT_FILENAME = 'QUID.o';
-  
-  STR_ASSEMBLER_EXT = '.S';
-  STR_OBJECT_EXT = '.o';
-
-  STR_RESOURCE_TMP_EXT = '.pprsc';
-  STR_RESOURCE_EXT = '.rsc';
-
-{ Strings from the project file }
-const
-  { Sections }
-  STR_PRJ_Main = 'Main';
-  STR_PRJ_FPC = 'FPC';
-  STR_PRJ_UIDs = 'UIDs';
-  STR_PRJ_Files = 'Files';
-  STR_PRJ_Objects = 'Objects';
-  STR_PRJ_RTLObjects = 'RTLObjects';
-
-  { Identifiers }
-  STR_PRJ_EXEName = 'EXEName';
-  STR_PRJ_Language = 'Language';
-  STR_PRJ_CompilerDir = 'CompilerDir';
-  STR_PRJ_ProjectType = 'ProjectType';
-  STR_PRJ_SDK = 'SDK';
-  STR_PRJ_SDKVersion = 'SDKVersion';
-  STR_PRJ_Emulator = 'Emulator';
-
-  STR_PRJ_CompilerPath = 'CompilerPath';
-  STR_PRJ_AssemblerPath = 'AssemblerPath';
-  STR_PRJ_RTLUnitsDir = 'RTLUnitsDir';
-
-  STR_PRJ_UID2 = 'UID2';
-  STR_PRJ_UID3 = 'UID3';
-
-  STR_PRJ_MainSource = 'mainsource';
-  STR_PRJ_MainResource = 'mainresource';
-  STR_PRJ_RegResource = 'regresource';
-
-  STR_PRJ_File = 'file';
-
-  { Options }
-  
-  STR_OPT_Cpp = 'C++';
-  STR_OPT_Pascal = 'Pascal';
-
-implementation
-
-end.
-
+{
+constants.pas
+
+Constants
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit constants;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+type
+
+  { Options from the command line }
+
+  TMkSymbianTask = (stNothing, stBuildApp, stBuildBindings);
+
+  TMkSymbianOptions = record
+    Task: TMkSymbianTask;
+    ProjectFile: string;
+  end;
+
+{ Constants and types for the SDK version }
+type
+  TSDKVersion = (sdkUIQ21, sdkUIQ3);
+
+const
+  Str_UIQ21 = 'UIQ 2.1';
+  Str_UIQ3  = 'UIQ 3';
+
+{ Commands }
+
+const
+  paramBuild = 'build';
+  paramBindings = 'bindings';
+  paramShowPath = 'showpath';
+
+{ Paths on the SDK }
+const
+  { UIQ 2 Paths }
+  Str_Path_UIQ2_ARM_BINUTILS = 'epoc32\gcc\bin\';
+  Str_Path_UIQ2_Makmake = 'epoc32\tools\makmake.pl';
+
+  { UIQ 3 Paths }
+  Str_Path_CWTools = 'epoc32\tools\nokia_compiler\Symbian_Tools\Command_Line_Tools\';
+  Str_Path_RComp = 'epoc32\tools\rcomp.exe';
+  Str_Path_Cpp = 'epoc32\tools\scpp.exe';
+  Str_Path_Resource_Files = 'epoc32\release\winscw\udeb\Z\resource\apps\';
+  Str_Path_Emulator_Registration = 'epoc32\release\winscw\udeb\Z\private\10003a3f\apps\';
+
+{ Other constants }
+const
+  UID_SOURCE_FILENAME = 'QUID.cpp';
+  UID_OBJECT_FILENAME = 'QUID.o';
+  
+  STR_ASSEMBLER_EXT = '.S';
+  STR_OBJECT_EXT = '.o';
+
+  STR_RESOURCE_TMP_EXT = '.pprsc';
+  STR_RESOURCE_EXT = '.rsc';
+
+{ Strings from the project file }
+const
+  { Sections }
+  STR_PRJ_Main = 'Main';
+  STR_PRJ_FPC = 'FPC';
+  STR_PRJ_UIDs = 'UIDs';
+  STR_PRJ_Files = 'Files';
+  STR_PRJ_Objects = 'Objects';
+  STR_PRJ_RTLObjects = 'RTLObjects';
+
+  { Identifiers }
+  STR_PRJ_EXEName = 'EXEName';
+  STR_PRJ_Language = 'Language';
+  STR_PRJ_CompilerDir = 'CompilerDir';
+  STR_PRJ_ProjectType = 'ProjectType';
+  STR_PRJ_SDK = 'SDK';
+  STR_PRJ_SDKVersion = 'SDKVersion';
+  STR_PRJ_Emulator = 'Emulator';
+
+  STR_PRJ_CompilerPath = 'CompilerPath';
+  STR_PRJ_AssemblerPath = 'AssemblerPath';
+  STR_PRJ_RTLUnitsDir = 'RTLUnitsDir';
+
+  STR_PRJ_UID2 = 'UID2';
+  STR_PRJ_UID3 = 'UID3';
+
+  STR_PRJ_MainSource = 'mainsource';
+  STR_PRJ_MainResource = 'mainresource';
+  STR_PRJ_RegResource = 'regresource';
+
+  STR_PRJ_File = 'file';
+
+  { Options }
+  
+  STR_OPT_Cpp = 'C++';
+  STR_OPT_Pascal = 'Pascal';
+
+implementation
+
+end.
+

+ 79 - 79
utils/mksymbian/mksymbian.lpi

@@ -1,79 +1,79 @@
-<?xml version="1.0"?>
-<CONFIG>
-  <ProjectOptions>
-    <PathDelim Value="\"/>
-    <Version Value="6"/>
-    <General>
-      <Flags>
-        <MainUnitHasUsesSectionForAllUnits Value="False"/>
-        <MainUnitHasCreateFormStatements Value="False"/>
-        <MainUnitHasTitleStatement Value="False"/>
-      </Flags>
-      <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
-      <IconPath Value="./"/>
-      <TargetFileExt Value=".exe"/>
-    </General>
-    <VersionInfo>
-      <ProjectVersion Value=""/>
-    </VersionInfo>
-    <PublishOptions>
-      <Version Value="2"/>
-      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
-      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
-    </PublishOptions>
-    <RunParams>
-      <local>
-        <FormatVersion Value="1"/>
-        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
-      </local>
-    </RunParams>
-    <Units Count="7">
-      <Unit0>
-        <Filename Value="mksymbian.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="mksymbian"/>
-      </Unit0>
-      <Unit1>
-        <Filename Value="cmdline.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="cmdline"/>
-      </Unit1>
-      <Unit2>
-        <Filename Value="constants.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="constants"/>
-      </Unit2>
-      <Unit3>
-        <Filename Value="cfgfile.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="cfgfile"/>
-      </Unit3>
-      <Unit4>
-        <Filename Value="sdkutil.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="sdkutil"/>
-      </Unit4>
-      <Unit5>
-        <Filename Value="compiler.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="compiler"/>
-      </Unit5>
-      <Unit6>
-        <Filename Value="projectparser.pas"/>
-        <IsPartOfProject Value="True"/>
-        <UnitName Value="projectparser"/>
-      </Unit6>
-    </Units>
-  </ProjectOptions>
-  <CompilerOptions>
-    <Version Value="5"/>
-    <PathDelim Value="\"/>
-    <CodeGeneration>
-      <Generate Value="Faster"/>
-    </CodeGeneration>
-    <Other>
-      <CompilerPath Value="$(CompPath)"/>
-    </Other>
-  </CompilerOptions>
-</CONFIG>
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <PathDelim Value="\"/>
+    <Version Value="6"/>
+    <General>
+      <Flags>
+        <MainUnitHasUsesSectionForAllUnits Value="False"/>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
+      <IconPath Value="./"/>
+      <TargetFileExt Value=".exe"/>
+    </General>
+    <VersionInfo>
+      <ProjectVersion Value=""/>
+    </VersionInfo>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <Units Count="7">
+      <Unit0>
+        <Filename Value="mksymbian.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="mksymbian"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="cmdline.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="cmdline"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="constants.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="constants"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="cfgfile.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="cfgfile"/>
+      </Unit3>
+      <Unit4>
+        <Filename Value="sdkutil.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="sdkutil"/>
+      </Unit4>
+      <Unit5>
+        <Filename Value="compiler.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="compiler"/>
+      </Unit5>
+      <Unit6>
+        <Filename Value="projectparser.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="projectparser"/>
+      </Unit6>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="5"/>
+    <PathDelim Value="\"/>
+    <CodeGeneration>
+      <Generate Value="Faster"/>
+    </CodeGeneration>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+</CONFIG>

+ 94 - 94
utils/mksymbian/mksymbian.pas

@@ -1,94 +1,94 @@
-{
-mksymbian.pas
-
-Main program file
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-program mksymbian;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-{$apptype console}
-
-uses
-  Classes, SysUtils,
-  cmdline, constants, cfgfile, sdkutil, compiler, projectparser;
-
-var
-  opts: TMkSymbianOptions;
-begin
-
-  vProject := TProject.Create;
-  vSDKUtil := TSDKUtil.Create;
-  vCmdLine := TCmdLine.Create;
-  vCompiler := TCompiler.Create;
-
-  try
-    vCmdLine.ParseCmdLineOptions(opts);
-    
-    vCompiler.opts := opts;
-    vProject.opts := opts;
-
-    case opts.task of
-
-      stBuildApp:
-      begin
-        vProject.ParseFile;
-        
-        { compilation }
-        
-        if CompareText(vProject.Language, STR_OPT_Cpp) = 0 then
-         vCompiler.MakeBuildCpp
-        else
-         vCompiler.MakeBuildPascal;
-
-        if vSDKUtil.SDKVersion = sdkUIQ3 then
-        begin
-          { Main resource file }
-        
-          vCompiler.BuildResource(vProject.MainResource);
-
-          vCompiler.InstallResource(vProject.MainResource);
-
-          { Registration resource file }
-        
-          vCompiler.BuildResource(vProject.RegResource);
-
-          vCompiler.RegisterInEmulator;
-        end;
-      end;
-
-      stBuildBindings:
-      begin
-        vProject.ParseFile;
-
-        vCompiler.MakeBuildBindings;
-      end;
-    end;
-    
-  finally
-    vCmdLine.Free;
-    vSDKUtil.Free;
-    vCompiler.Free;
-    vProject.Free;
-  end;
-end.
-
+{
+mksymbian.pas
+
+Main program file
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+program mksymbian;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+{$apptype console}
+
+uses
+  Classes, SysUtils,
+  cmdline, constants, cfgfile, sdkutil, compiler, projectparser;
+
+var
+  opts: TMkSymbianOptions;
+begin
+
+  vProject := TProject.Create;
+  vSDKUtil := TSDKUtil.Create;
+  vCmdLine := TCmdLine.Create;
+  vCompiler := TCompiler.Create;
+
+  try
+    vCmdLine.ParseCmdLineOptions(opts);
+    
+    vCompiler.opts := opts;
+    vProject.opts := opts;
+
+    case opts.task of
+
+      stBuildApp:
+      begin
+        vProject.ParseFile;
+        
+        { compilation }
+        
+        if CompareText(vProject.Language, STR_OPT_Cpp) = 0 then
+         vCompiler.MakeBuildCpp
+        else
+         vCompiler.MakeBuildPascal;
+
+        if vSDKUtil.SDKVersion = sdkUIQ3 then
+        begin
+          { Main resource file }
+        
+          vCompiler.BuildResource(vProject.MainResource);
+
+          vCompiler.InstallResource(vProject.MainResource);
+
+          { Registration resource file }
+        
+          vCompiler.BuildResource(vProject.RegResource);
+
+          vCompiler.RegisterInEmulator;
+        end;
+      end;
+
+      stBuildBindings:
+      begin
+        vProject.ParseFile;
+
+        vCompiler.MakeBuildBindings;
+      end;
+    end;
+    
+  finally
+    vCmdLine.Free;
+    vSDKUtil.Free;
+    vCompiler.Free;
+    vProject.Free;
+  end;
+end.
+

+ 125 - 125
utils/mksymbian/projectparser.pas

@@ -1,125 +1,125 @@
-{
-projectparser.pas
-
-Parses the project file
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit projectparser;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils, IniFiles,
-  constants;
-
-type
-
-  { TProject }
-
-  TProject = class(TObject)
-  public
-    opts: TMkSymbianOptions;
-    { Main section }
-    ExeName, Language, ProjectType, SDK, SDKVersion: string;
-    Emulator: Boolean;
-    { FPC section }
-    CompilerPath, AssemblerPath, RTLUnitsDir: string;
-    { UIDs section }
-    UID2, UID3: string;
-    { Files section }
-    MainSource, MainSourceNoExt, MainSourceAsm, MainSourceObj,
-     MainResource, RegResource: string;
-    { Objects section }
-    ObjectFiles: TStringList;
-  public
-    constructor Create;
-    destructor Destroy; override;
-    procedure ParseFile;
-  end;
-
-var
-  vProject: TProject;
-
-implementation
-
-{ TProject }
-
-constructor TProject.Create;
-begin
-  inherited Create;
-  
-  ObjectFiles := TStringList.Create;
-end;
-
-destructor TProject.Destroy;
-begin
-  ObjectFiles.Free;
-
-  inherited Destroy;
-end;
-
-{*******************************************************************
-*  TProject.ParseFile ()
-*
-*  DESCRIPTION:    Parses the project file
-*
-*  PARAMETERS:     None
-*
-*  RETURNS:        Nothing
-*
-*******************************************************************}
-procedure TProject.ParseFile;
-var
-  IniFile: TIniFile;
-begin
-  IniFile := TIniFile.Create(opts.ProjectFile);
-  try
-    ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
-    Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
-    ProjectType := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ProjectType, 'EXE');
-    SDK := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDK, 'UIQ');
-    SDKVersion := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDKVersion, '2.1');
-    Emulator := IniFile.ReadBool(STR_PRJ_Files, STR_PRJ_Emulator, False);
-
-    CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
-    AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
-    RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
-
-    UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
-    UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
-
-    MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
-    MainSourceNoExt := ExtractFileExt(MainSource);
-    MainSourceAsm := ChangeFileExt(MainSource, STR_ASSEMBLER_EXT);
-    MainSourceObj := ChangeFileExt(MainSource, STR_OBJECT_EXT);
-    MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
-    RegResource :=  IniFile.ReadString(STR_PRJ_Files, STR_PRJ_RegResource, 'default_reg.rss');
-    
-    IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
-  finally
-    IniFile.Free;
-  end;
-end;
-
-end.
-
+{
+projectparser.pas
+
+Parses the project file
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit projectparser;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, IniFiles,
+  constants;
+
+type
+
+  { TProject }
+
+  TProject = class(TObject)
+  public
+    opts: TMkSymbianOptions;
+    { Main section }
+    ExeName, Language, ProjectType, SDK, SDKVersion: string;
+    Emulator: Boolean;
+    { FPC section }
+    CompilerPath, AssemblerPath, RTLUnitsDir: string;
+    { UIDs section }
+    UID2, UID3: string;
+    { Files section }
+    MainSource, MainSourceNoExt, MainSourceAsm, MainSourceObj,
+     MainResource, RegResource: string;
+    { Objects section }
+    ObjectFiles: TStringList;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    procedure ParseFile;
+  end;
+
+var
+  vProject: TProject;
+
+implementation
+
+{ TProject }
+
+constructor TProject.Create;
+begin
+  inherited Create;
+  
+  ObjectFiles := TStringList.Create;
+end;
+
+destructor TProject.Destroy;
+begin
+  ObjectFiles.Free;
+
+  inherited Destroy;
+end;
+
+{*******************************************************************
+*  TProject.ParseFile ()
+*
+*  DESCRIPTION:    Parses the project file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TProject.ParseFile;
+var
+  IniFile: TIniFile;
+begin
+  IniFile := TIniFile.Create(opts.ProjectFile);
+  try
+    ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
+    Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
+    ProjectType := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ProjectType, 'EXE');
+    SDK := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDK, 'UIQ');
+    SDKVersion := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_SDKVersion, '2.1');
+    Emulator := IniFile.ReadBool(STR_PRJ_Files, STR_PRJ_Emulator, False);
+
+    CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
+    AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
+    RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
+
+    UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
+    UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
+
+    MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
+    MainSourceNoExt := ExtractFileExt(MainSource);
+    MainSourceAsm := ChangeFileExt(MainSource, STR_ASSEMBLER_EXT);
+    MainSourceObj := ChangeFileExt(MainSource, STR_OBJECT_EXT);
+    MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
+    RegResource :=  IniFile.ReadString(STR_PRJ_Files, STR_PRJ_RegResource, 'default_reg.rss');
+    
+    IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
+  finally
+    IniFile.Free;
+  end;
+end;
+
+end.
+

+ 102 - 102
utils/mksymbian/sdkutil.pas

@@ -1,102 +1,102 @@
-{
-sdkutil.pas
-
-SDK utility methods
-
-Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
-
-This file is part of MkSymbian build tool.
-
-MkSymbian is free software;
-you can redistribute it and/or modify it under the
-terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-MkSymbian is distributed in the hope
-that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-Please note that the General Public License version 2 does not permit
-incorporating MkSymbian into proprietary programs.
-}
-unit sdkutil;
-
-{$ifdef fpc}
-  {$mode delphi}{$H+}
-{$endif}
-
-interface
-
-uses
-  Classes, SysUtils, registry, constants;
-
-type
-
-  { TSDKUtil }
-
-  TSDKUtil = class(TObject)
-  public
-    SDKFolder, SDKPartialFolder, StrSDKVersion: string;
-    SDKVersion: TSDKVersion;
-    constructor Create;
-    procedure LocateUIQ2SDK;
-    procedure LocateUIQ3SDK;
-  end;
-
-var
-  vSDKUtil: TSDKUtil;
-
-implementation
-
-uses projectparser;
-
-{ TSDKUtil }
-
-constructor TSDKUtil.Create;
-begin
-  StrSDKVersion := vProject.SDK + ' ' + vProject.SDKVersion;
-
-  if StrSDKVersion = Str_UIQ21 then SDKVersion := sdkUIQ21
-  else if StrSDKVersion = Str_UIQ3 then SDKVersion := sdkUIQ3;
-
-  case SDKVersion of
-   sdkUIQ21: LocateUIQ2SDK;
-   sdkUIQ3:  LocateUIQ3SDK;
-  end;
-end;
-
-procedure TSDKUtil.LocateUIQ2SDK;
-begin
-  SDKPartialFolder := '\Programas\UIQ21\';
-  SDKFolder := 'C:' + SDKPartialFolder;
-end;
-
-procedure TSDKUtil.LocateUIQ3SDK;
-var
-  Reg: TRegistry;
-  BufferStr: string;
-begin
-  Reg := TRegistry.Create;
- 
-  try
-    Reg.RootKey := HKEY_LOCAL_MACHINE;
-    if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
-    begin
-      BufferStr := Reg.ReadString('InstallPath');
-      SDKFolder := IncludeTrailingBackslash(BufferStr);
-      SDKPartialFolder := Copy(SDKFolder, 3, Length(SDKFolder) - 2);
-    end
-    else
-    begin
-      WriteLn('  ERROR: Could not locate the SDK, using default values');
-      SDKPartialFolder := '\Symbian\UIQ3SDK\';
-      SDKFolder := 'C:' + SDKPartialFolder;
-    end;
-  finally
-    Reg.Free;
-  end;
-end;
-
-end.
-
+{
+sdkutil.pas
+
+SDK utility methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit sdkutil;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, registry, constants;
+
+type
+
+  { TSDKUtil }
+
+  TSDKUtil = class(TObject)
+  public
+    SDKFolder, SDKPartialFolder, StrSDKVersion: string;
+    SDKVersion: TSDKVersion;
+    constructor Create;
+    procedure LocateUIQ2SDK;
+    procedure LocateUIQ3SDK;
+  end;
+
+var
+  vSDKUtil: TSDKUtil;
+
+implementation
+
+uses projectparser;
+
+{ TSDKUtil }
+
+constructor TSDKUtil.Create;
+begin
+  StrSDKVersion := vProject.SDK + ' ' + vProject.SDKVersion;
+
+  if StrSDKVersion = Str_UIQ21 then SDKVersion := sdkUIQ21
+  else if StrSDKVersion = Str_UIQ3 then SDKVersion := sdkUIQ3;
+
+  case SDKVersion of
+   sdkUIQ21: LocateUIQ2SDK;
+   sdkUIQ3:  LocateUIQ3SDK;
+  end;
+end;
+
+procedure TSDKUtil.LocateUIQ2SDK;
+begin
+  SDKPartialFolder := '\Programas\UIQ21\';
+  SDKFolder := 'C:' + SDKPartialFolder;
+end;
+
+procedure TSDKUtil.LocateUIQ3SDK;
+var
+  Reg: TRegistry;
+  BufferStr: string;
+begin
+  Reg := TRegistry.Create;
+ 
+  try
+    Reg.RootKey := HKEY_LOCAL_MACHINE;
+    if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
+    begin
+      BufferStr := Reg.ReadString('InstallPath');
+      SDKFolder := IncludeTrailingBackslash(BufferStr);
+      SDKPartialFolder := Copy(SDKFolder, 3, Length(SDKFolder) - 2);
+    end
+    else
+    begin
+      WriteLn('  ERROR: Could not locate the SDK, using default values');
+      SDKPartialFolder := '\Symbian\UIQ3SDK\';
+      SDKFolder := 'C:' + SDKPartialFolder;
+    end;
+  finally
+    Reg.Free;
+  end;
+end;
+
+end.
+