mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-14 20:50:03 +02:00
releasecreator: added option fpcdir
This commit is contained in:
parent
f00d79df31
commit
8a47a8d61a
@ -41,6 +41,7 @@ type
|
||||
Pas2jsVersion: string;
|
||||
Simulate: boolean;
|
||||
SourceDir: string; // cloned git release
|
||||
FPCDir: string;
|
||||
Verbosity: integer;
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -96,7 +97,7 @@ begin
|
||||
// quick check parameters
|
||||
ErrorMsg:=CheckOptions('hb:c:s:l:qvx', ['help', 'config:',
|
||||
'builddir:', 'sourcedir:', 'quiet', 'verbose', 'execute',
|
||||
'fpcrelease:', 'fpcdevel:', 'fpc2:', 'fpc2target:',
|
||||
'fpcrelease:', 'fpcdevel:', 'fpcdir:', 'fpc2:', 'fpc2target:',
|
||||
'git:', 'make:', 'zip:']);
|
||||
if ErrorMsg<>'' then
|
||||
Err(ErrorMsg);
|
||||
@ -132,6 +133,7 @@ begin
|
||||
SourceDir:=GetOption_Directory('s','sourcedir',nil);
|
||||
if SourceDir='' then
|
||||
Err('missing source directory');
|
||||
FPCDir:=GetOption_Directory(' ','fpcdir',nil);
|
||||
FPCReleaseFilename:=GetOption_Executable(' ','fpcrelease',nil);
|
||||
FPCDevelFilename:=GetOption_Executable(' ','fpcdevel',nil);
|
||||
FPC2Filename:=GetOption_Executable(' ','fpc2',nil);
|
||||
@ -140,10 +142,16 @@ begin
|
||||
MakeFilename:=GetOption_Executable(' ','make',@GetDefaultMake);
|
||||
ZipFilename:=GetOption_Executable(' ','zip',@GetDefaultZip);
|
||||
|
||||
if FPCDir='' then
|
||||
FPCDir:=GetEnvironmentVariable('FPCDIR');
|
||||
if FPCDir='' then
|
||||
FPCDir:=SourceDir+'compiler'+PathDelim;
|
||||
|
||||
// write options
|
||||
if Verbosity>=0 then begin
|
||||
Log(etInfo,'SourceDir: "'+SourceDir+'"');
|
||||
Log(etInfo,'BuildDir: "'+BuildDir+'"');
|
||||
Log(etInfo,'FPCDir: "'+FPCDir+'"');
|
||||
Log(etInfo,'FPCRelease: "'+FPCReleaseFilename+'"');
|
||||
Log(etInfo,'FPCDevel: "'+FPCDevelFilename+'"');
|
||||
Log(etInfo,'FPC2: "'+FPC2Filename+'"');
|
||||
@ -163,6 +171,8 @@ begin
|
||||
Err('BuildDir missing: "'+BuildDir+'"');
|
||||
if not DirectoryExists(SourceDir) then
|
||||
Err('SourceDir missing: "'+SourceDir+'"');
|
||||
if not DirectoryExists(FPCDir) then
|
||||
Err('FPCDir missing: "'+FPCDir+'"');
|
||||
CheckExecutable(FPCReleaseFilename,'fpcrelease');
|
||||
CheckExecutable(FPCDevelFilename,'fpcdevel');
|
||||
if FPC2Filename<>'' then
|
||||
@ -216,8 +226,10 @@ begin
|
||||
writeln;
|
||||
writeln('Required parameters:');
|
||||
writeln('-s <filename>, --sourcedir=<filename>: git directory of the pas2js release');
|
||||
writeln('--fpcdir=<filename>: Path of fpc devel sources.');
|
||||
writeln(' Used for compiling pas2js and libpas2js.');
|
||||
writeln('--fpcrelease=<filename>: Path of released version fpc executable.');
|
||||
writeln(' Used for pas2js and libpas2js.');
|
||||
writeln(' Used for compiling pas2js and libpas2js.');
|
||||
writeln('--fpcdevel=<filename>: Path of development version fpc executable.');
|
||||
writeln(' Used for compiling the other tools.');
|
||||
writeln('--fpc2=<filename>: Path of a secondary fpc for building a second libpas2js.');
|
||||
@ -293,7 +305,7 @@ begin
|
||||
sl:=TStringList.Create;
|
||||
try
|
||||
// read pas2js version number from Pascal sources
|
||||
Filename:=SourceDir+SetDirSeparators('compiler/packages/pastojs/src/pas2jscompiler.pp');
|
||||
Filename:=FPCDir+SetDirSeparators('packages/pastojs/src/pas2jscompiler.pp');
|
||||
if Verbosity>0 then
|
||||
Log(etInfo,'Reading version from "'+Filename+'" ...');
|
||||
if not FileExists(Filename) then
|
||||
@ -326,7 +338,7 @@ begin
|
||||
Log(etInfo,'Pas2js version is '+Pas2jsVersion);
|
||||
|
||||
// read version number from rtl.js
|
||||
Filename:=SourceDir+SetDirSeparators('compiler/utils/pas2js/dist/rtl.js');
|
||||
Filename:=FPCDir+SetDirSeparators('utils/pas2js/dist/rtl.js');
|
||||
if Verbosity>0 then
|
||||
Log(etInfo,'Reading version from "'+Filename+'" ...');
|
||||
if not FileExists(Filename) then
|
||||
@ -360,11 +372,11 @@ procedure TPas2jsReleaseCreator.CheckForgottenWriteln;
|
||||
end;
|
||||
|
||||
begin
|
||||
Check(SourceDir+'compiler'+PathDelim+'packages'+PathDelim+'fcl-js'+PathDelim+'src');
|
||||
Check(SourceDir+'compiler'+PathDelim+'packages'+PathDelim+'fcl-json'+PathDelim+'src');
|
||||
Check(SourceDir+'compiler'+PathDelim+'packages'+PathDelim+'fcl-passrc'+PathDelim+'src');
|
||||
Check(SourceDir+'compiler'+PathDelim+'packages'+PathDelim+'pastojs'+PathDelim+'src');
|
||||
Check(SourceDir+'compiler'+PathDelim+'utils'+PathDelim+'pas2js');
|
||||
Check(FPCDir+'packages'+PathDelim+'fcl-js'+PathDelim+'src');
|
||||
Check(FPCDir+'packages'+PathDelim+'fcl-json'+PathDelim+'src');
|
||||
Check(FPCDir+'packages'+PathDelim+'fcl-passrc'+PathDelim+'src');
|
||||
Check(FPCDir+'packages'+PathDelim+'pastojs'+PathDelim+'src');
|
||||
Check(FPCDir+'utils'+PathDelim+'pas2js');
|
||||
end;
|
||||
|
||||
procedure TPas2jsReleaseCreator.ParseFPCTargetOption(const LongOpt: string; out
|
||||
@ -462,16 +474,15 @@ end;
|
||||
|
||||
procedure TPas2jsReleaseCreator.BuildTools(const TargetOS, TargetCPU: string);
|
||||
var
|
||||
WorkDir, SrcCompilerDir, PkgSrcDir, UnitOutDir, CurBinDir: String;
|
||||
WorkDir, PkgSrcDir, UnitOutDir, CurBinDir: String;
|
||||
SharedParams, TheParams: TStringList;
|
||||
begin
|
||||
SharedParams:=TStringList.Create;
|
||||
TheParams:=TStringList.Create;
|
||||
try
|
||||
SrcCompilerDir:=SourceDir+'compiler'+PathDelim;
|
||||
WorkDir:=SrcCompilerDir+'utils'+PathDelim+'pas2js';
|
||||
WorkDir:=FPCDir+'utils'+PathDelim+'pas2js';
|
||||
|
||||
PkgSrcDir:=SrcCompilerDir+'packages'+PathDelim;
|
||||
PkgSrcDir:=FPCDir+'packages'+PathDelim;
|
||||
SharedParams.Add('-Fu'+PkgSrcDir+'fcl-js'+PathDelim+'src');
|
||||
SharedParams.Add('-Fu'+PkgSrcDir+'fcl-json'+PathDelim+'src');
|
||||
SharedParams.Add('-Fu'+PkgSrcDir+'fcl-passrc'+PathDelim+'src');
|
||||
@ -591,7 +602,7 @@ procedure TPas2jsReleaseCreator.CopyRTLjs;
|
||||
var
|
||||
SrcFilename, DestFilename: String;
|
||||
begin
|
||||
SrcFilename:=SourceDir+SetDirSeparators('compiler/utils/pas2js/dist/rtl.js');
|
||||
SrcFilename:=FPCDir+SetDirSeparators('utils/pas2js/dist/rtl.js');
|
||||
DestFilename:=BuildDir_Sources+SetDirSeparators('packages/rtl/src/rtl.js');
|
||||
if Simulate then begin
|
||||
Log(etInfo,'Simulate: Copying "'+SrcFilename+'" -> "'+DestFilename+'"');
|
||||
|
Loading…
Reference in New Issue
Block a user