mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 14:29:21 +02:00
* internal fpmkunit source for bootstrapping
git-svn-id: trunk@8992 -
This commit is contained in:
parent
a0984505b2
commit
277147d1b1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8694,6 +8694,7 @@ utils/fppkg/fcl20/streamcoll.pp svneol=native#text/plain
|
|||||||
utils/fppkg/fcl20/uriparser.pp svneol=native#text/plain
|
utils/fppkg/fcl20/uriparser.pp svneol=native#text/plain
|
||||||
utils/fppkg/fcl20/zipper.pp svneol=native#text/plain
|
utils/fppkg/fcl20/zipper.pp svneol=native#text/plain
|
||||||
utils/fppkg/fcl20/zstream.pp svneol=native#text/plain
|
utils/fppkg/fcl20/zstream.pp svneol=native#text/plain
|
||||||
|
utils/fppkg/fpmkunitsrc.inc svneol=native#text/plain
|
||||||
utils/fppkg/fppkg.lpi svneol=native#text/plain
|
utils/fppkg/fppkg.lpi svneol=native#text/plain
|
||||||
utils/fppkg/fppkg.pp svneol=native#text/plain
|
utils/fppkg/fppkg.pp svneol=native#text/plain
|
||||||
utils/fppkg/fprepos.pp svneol=native#text/plain
|
utils/fppkg/fprepos.pp svneol=native#text/plain
|
||||||
|
@ -3564,6 +3564,15 @@ endif
|
|||||||
fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
|
fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
|
||||||
fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
|
fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
|
||||||
fpc_makefiles: fpc_makefile fpc_makefile_dirs
|
fpc_makefiles: fpc_makefile fpc_makefile_dirs
|
||||||
|
ifndef DATA2INC
|
||||||
|
DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARCHPATH))))
|
||||||
|
ifeq ($(DATA2INC),)
|
||||||
|
DATA2INC= __missing_command_DATA2INC
|
||||||
|
else
|
||||||
|
DATA2INC:=$(firstword $(DATA2INC))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
export DATA2INC
|
||||||
all: fpc_all
|
all: fpc_all
|
||||||
debug: fpc_debug
|
debug: fpc_debug
|
||||||
smart: fpc_smart
|
smart: fpc_smart
|
||||||
@ -3589,3 +3598,8 @@ ifneq ($(wildcard fpcmake.loc),)
|
|||||||
include fpcmake.loc
|
include fpcmake.loc
|
||||||
endif
|
endif
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
ifneq ($(DATA2INC),)
|
||||||
|
fpmkunitsrc.inc: $(DEFAULT_FPCDIR)/packages/fpmkunit/src/fpmkunit.pp
|
||||||
|
$(DATA2INC) -b -s $(DEFAULT_FPCDIR)/packages/fpmkunit/src/fpmkunit.pp fpmkunitsrc.inc fpmkunitsrc
|
||||||
|
endif
|
||||||
|
fppkg$(EXEEXT): $(wildcard pkg*.pp) fpmkunitsrc.inc
|
||||||
|
@ -37,6 +37,7 @@ fpcdir=../..
|
|||||||
|
|
||||||
[require]
|
[require]
|
||||||
packages=fcl-base fcl-xml fcl-process paszlib libcurl
|
packages=fcl-base fcl-xml fcl-process paszlib libcurl
|
||||||
|
tools=data2inc
|
||||||
|
|
||||||
[prerules]
|
[prerules]
|
||||||
# Compatibility to compile with 2.0.x
|
# Compatibility to compile with 2.0.x
|
||||||
@ -49,3 +50,9 @@ endif
|
|||||||
|
|
||||||
[rules]
|
[rules]
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
ifneq ($(DATA2INC),)
|
||||||
|
fpmkunitsrc.inc: $(DEFAULT_FPCDIR)/packages/fpmkunit/src/fpmkunit.pp
|
||||||
|
$(DATA2INC) -b -s $(DEFAULT_FPCDIR)/packages/fpmkunit/src/fpmkunit.pp fpmkunitsrc.inc fpmkunitsrc
|
||||||
|
endif
|
||||||
|
|
||||||
|
fppkg$(EXEEXT): $(wildcard pkg*.pp) fpmkunitsrc.inc
|
||||||
|
4382
utils/fppkg/fpmkunitsrc.inc
Normal file
4382
utils/fppkg/fpmkunitsrc.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -56,6 +56,44 @@ type
|
|||||||
Function Execute(const Args:TActionArgs):boolean;override;
|
Function Execute(const Args:TActionArgs):boolean;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TMyMemoryStream=class(TMemoryStream)
|
||||||
|
public
|
||||||
|
constructor Create(p:pointer;mysize:integer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$i fpmkunitsrc.inc}
|
||||||
|
|
||||||
|
procedure CreateFPMKUnitSource(const AFileName:string);
|
||||||
|
var
|
||||||
|
InStream,
|
||||||
|
OutStream : TStream;
|
||||||
|
pend : pchar;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
// Don't write trailing #0
|
||||||
|
pend:=pchar(@fpmkunitsrc)+sizeof(fpmkunitsrc)-1;
|
||||||
|
while pend^=#0 do
|
||||||
|
dec(pend);
|
||||||
|
InStream:=TMyMemoryStream.Create(@fpmkunitsrc,pend-pchar(@fpmkunitsrc));
|
||||||
|
OutStream:=TFileStream.Create(AFileName,fmCreate);
|
||||||
|
OutStream.CopyFrom(InStream,InStream.Size);
|
||||||
|
finally
|
||||||
|
InStream.Destroy;
|
||||||
|
OutStream.Destroy;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{*****************************************************************************
|
||||||
|
TMyMemoryStream
|
||||||
|
*****************************************************************************}
|
||||||
|
|
||||||
|
constructor TMyMemoryStream.Create(p:pointer;mysize:integer);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
SetPointer(p,mysize);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TFPMakeCompiler }
|
{ TFPMakeCompiler }
|
||||||
|
|
||||||
@ -63,12 +101,12 @@ Procedure TFPMakeCompiler.CompileFPMake;
|
|||||||
const
|
const
|
||||||
TempBuildDir = 'build-fpmake';
|
TempBuildDir = 'build-fpmake';
|
||||||
Var
|
Var
|
||||||
i : Integer;
|
|
||||||
OOptions,
|
OOptions,
|
||||||
BaseDir,
|
|
||||||
DepDir,
|
DepDir,
|
||||||
|
DepDir2,
|
||||||
FPMakeBin,
|
FPMakeBin,
|
||||||
FPMakeSrc : string;
|
FPMakeSrc : string;
|
||||||
|
NeedFPMKUnitSource,
|
||||||
DoBootStrap,
|
DoBootStrap,
|
||||||
HaveFpmake : boolean;
|
HaveFpmake : boolean;
|
||||||
begin
|
begin
|
||||||
@ -91,6 +129,7 @@ begin
|
|||||||
Error(SErrMissingFPMake);
|
Error(SErrMissingFPMake);
|
||||||
// Special bootstrapping mode to compile fpmake?
|
// Special bootstrapping mode to compile fpmake?
|
||||||
DoBootStrap:=False;
|
DoBootStrap:=False;
|
||||||
|
NeedFPMKUnitSource:=False;
|
||||||
if Options.BootStrap then
|
if Options.BootStrap then
|
||||||
begin
|
begin
|
||||||
{$ifdef check_bootstrap_names}
|
{$ifdef check_bootstrap_names}
|
||||||
@ -115,33 +154,67 @@ begin
|
|||||||
OOptions:=OOptions+' -g'
|
OOptions:=OOptions+' -g'
|
||||||
else
|
else
|
||||||
OOptions:=OOptions+' -O2 -XXs';
|
OOptions:=OOptions+' -O2 -XXs';
|
||||||
// Find required units directories
|
// Check overall unit dir, this must exist at least for RTL
|
||||||
if DoBootStrap then
|
if not DirectoryExists(Options.FPMakeUnitDir) then
|
||||||
BaseDir:='../'
|
Error(SErrMissingDirectory,[Options.FPMakeUnitDir]);
|
||||||
|
// Add FPMKUnit unit dir, if not found we use the internal fpmkunit source
|
||||||
|
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+'fpmkunit');
|
||||||
|
if DirectoryExists(DepDir) then
|
||||||
|
OOptions:=OOptions+' -Fu'+DepDir
|
||||||
else
|
else
|
||||||
BaseDir:=Options.FPMakeUnitDir;
|
|
||||||
if not DirectoryExists(BaseDir) then
|
|
||||||
Error(SErrMissingDirectory,[BaseDir]);
|
|
||||||
for i:=high(FPMKUnitDeps) downto low(FPMKUnitDeps) do
|
|
||||||
begin
|
begin
|
||||||
// RTL is always take from the installed compiler
|
if DoBootStrap then
|
||||||
if FPMKUnitDeps[i]='rtl' then
|
|
||||||
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+FPMKUnitDeps[i])
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
if DoBootStrap then
|
NeedFPMKUnitSource:=true;
|
||||||
DepDir:=IncludeTrailingPathDelimiter(BaseDir+FPMKUnitDeps[i]+PathDelim+'src')
|
OOptions:=OOptions+' -Fu'+TempBuildDir;
|
||||||
else
|
end
|
||||||
DepDir:=IncludeTrailingPathDelimiter(BaseDir+FPMKUnitDeps[i]);
|
else
|
||||||
end;
|
|
||||||
if not DirectoryExists(DepDir) then
|
|
||||||
Error(SErrMissingDirectory,[DepDir]);
|
Error(SErrMissingDirectory,[DepDir]);
|
||||||
OOptions:=OOptions+' -Fu'+DepDir;
|
|
||||||
end;
|
end;
|
||||||
|
// Add PaszLib and Hash units dir
|
||||||
|
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+'hash');
|
||||||
|
if not DirectoryExists(DepDir) then
|
||||||
|
begin
|
||||||
|
if DoBootStrap then
|
||||||
|
DepDir:=''
|
||||||
|
else
|
||||||
|
Error(SErrMissingDirectory,[DepDir]);
|
||||||
|
end;
|
||||||
|
DepDir2:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+'paszlib');
|
||||||
|
if not FileExists(DepDir2+'zipper.ppu') then
|
||||||
|
begin
|
||||||
|
if DoBootStrap then
|
||||||
|
DepDir2:=''
|
||||||
|
else
|
||||||
|
Error(SErrMissingDirectory,[DepDir2]);
|
||||||
|
end;
|
||||||
|
if (DepDir<>'') and (DepDir2<>'') then
|
||||||
|
OOptions:=OOptions+' -Fu'+DepDir+' -Fu'+DepDir2
|
||||||
|
else
|
||||||
|
OOptions:=OOptions+' -dNO_UNIT_ZIPPER';
|
||||||
|
// Add Process unit
|
||||||
|
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+'fcl-process');
|
||||||
|
if DirectoryExists(DepDir) then
|
||||||
|
OOptions:=OOptions+' -Fu'+DepDir
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if DoBootStrap then
|
||||||
|
OOptions:=OOptions+' -dNO_UNIT_PROCESS'
|
||||||
|
else
|
||||||
|
Error(SErrMissingDirectory,[DepDir]);
|
||||||
|
end;
|
||||||
|
// Add RTL unit dir
|
||||||
|
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+'rtl');
|
||||||
|
if not DirectoryExists(DepDir) then
|
||||||
|
Error(SErrMissingDirectory,[DepDir]);
|
||||||
|
OOptions:=OOptions+' -Fu'+DepDir;
|
||||||
// Units in a directory for easy cleaning
|
// Units in a directory for easy cleaning
|
||||||
DeleteDir(TempBuildDir);
|
DeleteDir(TempBuildDir);
|
||||||
ForceDirectories(TempBuildDir);
|
ForceDirectories(TempBuildDir);
|
||||||
OOptions:=OOptions+' -FU'+TempBuildDir;
|
OOptions:=OOptions+' -FU'+TempBuildDir;
|
||||||
|
// Create fpmkunit.pp if needed
|
||||||
|
if NeedFPMKUnitSource then
|
||||||
|
CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');
|
||||||
// Call compiler
|
// Call compiler
|
||||||
If ExecuteProcess(Options.FPMakeCompiler,OOptions+' '+FPmakeSrc)<>0 then
|
If ExecuteProcess(Options.FPMakeCompiler,OOptions+' '+FPmakeSrc)<>0 then
|
||||||
Error(SErrFailedToCompileFPCMake);
|
Error(SErrFailedToCompileFPCMake);
|
||||||
|
@ -18,7 +18,7 @@ Const
|
|||||||
{$endif unix}
|
{$endif unix}
|
||||||
|
|
||||||
// Dependencies for compiling the fpmkunit unit
|
// Dependencies for compiling the fpmkunit unit
|
||||||
FPMKUnitDeps : array[0..3] of string[8] = ('rtl','hash','paszlib','fpmkunit');
|
FPMKUnitDeps : array[0..4] of string[11] = ('rtl','hash','paszlib','fcl-process','fpmkunit');
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug);
|
TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug);
|
||||||
|
Loading…
Reference in New Issue
Block a user