mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:29:27 +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/zipper.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.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_dirs: fpc_makefile_sub1 fpc_makefile_sub2
|
||||
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
|
||||
debug: fpc_debug
|
||||
smart: fpc_smart
|
||||
@ -3589,3 +3598,8 @@ ifneq ($(wildcard fpcmake.loc),)
|
||||
include fpcmake.loc
|
||||
endif
|
||||
.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]
|
||||
packages=fcl-base fcl-xml fcl-process paszlib libcurl
|
||||
tools=data2inc
|
||||
|
||||
[prerules]
|
||||
# Compatibility to compile with 2.0.x
|
||||
@ -49,3 +50,9 @@ endif
|
||||
|
||||
[rules]
|
||||
.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;
|
||||
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 }
|
||||
|
||||
@ -63,12 +101,12 @@ Procedure TFPMakeCompiler.CompileFPMake;
|
||||
const
|
||||
TempBuildDir = 'build-fpmake';
|
||||
Var
|
||||
i : Integer;
|
||||
OOptions,
|
||||
BaseDir,
|
||||
DepDir,
|
||||
DepDir2,
|
||||
FPMakeBin,
|
||||
FPMakeSrc : string;
|
||||
NeedFPMKUnitSource,
|
||||
DoBootStrap,
|
||||
HaveFpmake : boolean;
|
||||
begin
|
||||
@ -91,6 +129,7 @@ begin
|
||||
Error(SErrMissingFPMake);
|
||||
// Special bootstrapping mode to compile fpmake?
|
||||
DoBootStrap:=False;
|
||||
NeedFPMKUnitSource:=False;
|
||||
if Options.BootStrap then
|
||||
begin
|
||||
{$ifdef check_bootstrap_names}
|
||||
@ -115,33 +154,67 @@ begin
|
||||
OOptions:=OOptions+' -g'
|
||||
else
|
||||
OOptions:=OOptions+' -O2 -XXs';
|
||||
// Find required units directories
|
||||
if DoBootStrap then
|
||||
BaseDir:='../'
|
||||
// Check overall unit dir, this must exist at least for RTL
|
||||
if not DirectoryExists(Options.FPMakeUnitDir) then
|
||||
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
|
||||
BaseDir:=Options.FPMakeUnitDir;
|
||||
if not DirectoryExists(BaseDir) then
|
||||
Error(SErrMissingDirectory,[BaseDir]);
|
||||
for i:=high(FPMKUnitDeps) downto low(FPMKUnitDeps) do
|
||||
begin
|
||||
// RTL is always take from the installed compiler
|
||||
if FPMKUnitDeps[i]='rtl' then
|
||||
DepDir:=IncludeTrailingPathDelimiter(Options.FPMakeUnitDir+FPMKUnitDeps[i])
|
||||
else
|
||||
if DoBootStrap then
|
||||
begin
|
||||
if DoBootStrap then
|
||||
DepDir:=IncludeTrailingPathDelimiter(BaseDir+FPMKUnitDeps[i]+PathDelim+'src')
|
||||
else
|
||||
DepDir:=IncludeTrailingPathDelimiter(BaseDir+FPMKUnitDeps[i]);
|
||||
end;
|
||||
if not DirectoryExists(DepDir) then
|
||||
NeedFPMKUnitSource:=true;
|
||||
OOptions:=OOptions+' -Fu'+TempBuildDir;
|
||||
end
|
||||
else
|
||||
Error(SErrMissingDirectory,[DepDir]);
|
||||
OOptions:=OOptions+' -Fu'+DepDir;
|
||||
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
|
||||
DeleteDir(TempBuildDir);
|
||||
ForceDirectories(TempBuildDir);
|
||||
OOptions:=OOptions+' -FU'+TempBuildDir;
|
||||
// Create fpmkunit.pp if needed
|
||||
if NeedFPMKUnitSource then
|
||||
CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');
|
||||
// Call compiler
|
||||
If ExecuteProcess(Options.FPMakeCompiler,OOptions+' '+FPmakeSrc)<>0 then
|
||||
Error(SErrFailedToCompileFPCMake);
|
||||
|
@ -18,7 +18,7 @@ Const
|
||||
{$endif unix}
|
||||
|
||||
// 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
|
||||
TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug);
|
||||
|
Loading…
Reference in New Issue
Block a user