You've already forked lazarus-ccr
instantfpc: added parameter --compiler=<path of compiler>
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1597 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -73,7 +73,11 @@ begin
|
||||
writeln('instantfpc --get-cache');
|
||||
writeln(' Prints cache directory to stdout.');
|
||||
writeln;
|
||||
writeln('Normal usage is to add as first line "#!/usr/bin/instantfpc" to a source');
|
||||
writeln('instantfpc --compiler=<path to compiler>');
|
||||
writeln(' Normally fpc is searched in PATH and used as compiler.');
|
||||
writeln;
|
||||
writeln('Normal usage is to add as first line ("shebang") "#!/usr/bin/instantfpc"');
|
||||
writeln('to a program source file. Then you can execute the source like a script.');
|
||||
Halt(0);
|
||||
end else if p='--get-cache' then begin
|
||||
CacheDir:=GetCacheDir;
|
||||
|
@ -103,13 +103,31 @@ begin
|
||||
end;
|
||||
|
||||
function GetCompiler: string;
|
||||
const
|
||||
CompilerParam = '--compiler=';
|
||||
var
|
||||
Path: String;
|
||||
p: Integer;
|
||||
StartPos: LongInt;
|
||||
Dir: String;
|
||||
CompFile: String;
|
||||
i: Integer;
|
||||
Param: String;
|
||||
begin
|
||||
for i:=1 to Paramcount do begin
|
||||
Param:=ParamStr(i);
|
||||
if (Param='') or (Param[1]<>'-') then break;
|
||||
if copy(Param,1,length(CompilerParam))=CompilerParam then begin
|
||||
CompFile:=copy(Param,length(CompilerParam)+1,length(Param));
|
||||
Result:=ExpandFileName(CompFile);
|
||||
if not FileExists(Result) then begin
|
||||
writeln('Error: '+CompFile+' not found, check the ',CompilerParam,' parameter.');
|
||||
Halt(1);
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF Windows}
|
||||
CompFile:='fpc.exe';
|
||||
{$ELSE}
|
||||
@ -129,7 +147,7 @@ begin
|
||||
inc(p);
|
||||
end;
|
||||
end;
|
||||
writeln(CompFile+' not found in PATH');
|
||||
writeln('Error: '+CompFile+' not found in PATH');
|
||||
Halt(1);
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user