IDE: when building lazarus from the IDE, let the Makefile set the codepage of the console to the code page used in the gui (windows only), fixes bug #11316

git-svn-id: trunk@15195 -
This commit is contained in:
vincents 2008-05-21 12:40:39 +00:00
parent 9454cec7f7
commit d42b49c565
3 changed files with 41 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/05/02]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/05/06]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@ -3160,7 +3160,7 @@ makefiles: fpc_makefiles
ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif
.PHONY: ide idepkg bigide starter lazbuilder all clean cleanide purge revisioninc
.PHONY: ide idepkg bigide starter lazbuilder all clean cleanide purge revisioninc codepage
revisioninc:
ifneq ($(USESVN2REVISIONINC),0)
ifeq ($(wildcard ../tools/svn2revisioninc$(SRCEXEEXT)),)
@ -3168,7 +3168,13 @@ ifeq ($(wildcard ../tools/svn2revisioninc$(SRCEXEEXT)),)
endif
../tools/svn2revisioninc$(SRCEXEEXT) .. revision.inc
endif
ide: $(COMPILER_UNITTARGETDIR) revisioninc
codepage:
ifneq ($(findstring $(OS_TARGET),win32 win64),)
ifneq ($(LAZWINCODEPAGE),)
chcp $(LAZWINCODEPAGE)
endif
endif
ide: $(COMPILER_UNITTARGETDIR) revisioninc codepage
ifeq ($(LAZARUS_OPT),)
$(MAKE) --assume-new=lazarus.pp lazarus$(EXEEXT)
else

View File

@ -117,7 +117,7 @@ endif
#-----------------------------------------------------------------------------
[rules]
.PHONY: ide idepkg bigide starter lazbuilder all clean cleanide purge revisioninc
.PHONY: ide idepkg bigide starter lazbuilder all clean cleanide purge revisioninc codepage
#-----------------------------------------------------------------------------
revisioninc:
@ -128,9 +128,16 @@ endif
../tools/svn2revisioninc$(SRCEXEEXT) .. revision.inc
endif
codepage:
ifneq ($(findstring $(OS_TARGET),win32 win64),)
ifneq ($(LAZWINCODEPAGE),)
chcp $(LAZWINCODEPAGE)
endif
endif
#-----------------------------------------------------------------------------
ide: $(COMPILER_UNITTARGETDIR) revisioninc
ide: $(COMPILER_UNITTARGETDIR) revisioninc codepage
ifeq ($(LAZARUS_OPT),)
$(MAKE) --assume-new=lazarus.pp lazarus$(EXEEXT)
else

View File

@ -41,7 +41,7 @@ unit BuildLazDialog;
interface
uses
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf,
Classes, SysUtils, LCLProc, LConvEncoding, Forms, Controls, LCLType, LCLIntf,
Graphics, GraphType, StdCtrls, ExtCtrls, Buttons, FileUtil, Dialogs,
LResources, Laz_XMLCfg, InterfaceBase, Themes, ComCtrls,
LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs,
@ -329,7 +329,7 @@ var
CurItem: TBuildLazarusItem;
ExtraOptions, LinkerAddition: String;
CurMakeMode: TMakeMode;
{$IFDEF win32}
// add compiler directory to the PATH, so that windres called by the compiler
// can find the preprocessor
@ -351,6 +351,24 @@ var
end;
{$ENDIF}
{$IFDEF windows}
// Set the code page of the console to the same code page as the windows
// code page to prevent problems with changed meaning of accented
// characters in Makefile paramaters, when Make call the shell
// to execute command with " in them
procedure SetLazWinCodePage;
var
CodePage: string;
begin
CodePage := GetSystemEncoding;
if CodePage=EncodingUTF8 then
CodePage := '65001'
else
Delete(CodePage, 1, 2);
Tool.EnvironmentOverrides.Values['LAZWINCODEPAGE'] := CodePage;
end;
{$ENDIF}
begin
Result:=mrCancel;
@ -365,6 +383,9 @@ begin
Tool.EnvironmentOverrides.Values['LCL_PLATFORM']:=
LCLPlatformDirNames[Options.LCLPlatform];
Tool.EnvironmentOverrides.Values['LANG']:= 'en_US';
{$IFDEF windows}
SetLazWinCodePage;
{$ENDIF}
if CompilerPath<>'' then
Tool.EnvironmentOverrides.Values['PP']:=CompilerPath;
if not FileExists(Tool.Filename) then begin