completed OSX port

to be tested
This commit is contained in:
Basile Burg 2016-02-17 07:48:16 +01:00
parent e019c81175
commit a48aed6345
7 changed files with 37 additions and 28 deletions

View File

@ -9,8 +9,7 @@ uses
Classes, SysUtils,
{$IFDEF WINDOWS}
Windows, JwaTlHelp32,
{$ENDIF}
{$IFDEF LINUX}
{$ELSE}
ExtCtrls, FileUtil, LazFileUtils,
{$ENDIF}
{$IFNDEF CEBUILD}
@ -64,7 +63,7 @@ type
* An idle timer is started when executing and trigs the event if necessary.
*)
TCheckedAsyncProcess = class(TAsyncProcess)
{$IFDEF LINUX}
{$IFNDEF WINDOWS}
private
fTimer: TIdleTimer;
procedure checkTerminated(sender: TObject);
@ -377,7 +376,7 @@ begin
exit(system.length(self));
end;
{$IFDEF LINUX}
{$IFNDEF WINDOWS}
constructor TCheckedAsyncProcess.Create(aOwner: TComponent);
begin
inherited;
@ -521,13 +520,9 @@ begin
end;
begin
result := aPath;
{$IFDEF MSWINDOWS}
{$IFDEF WINDOWS}
result := patchProc(result, '/');
{$ENDIF}
{$IFDEF UNIX}
result := patchProc(result, '\');
{$ENDIF}
{$IFDEF DARWIN}
{$ELSE}
result := patchProc(result, '\');
{$ENDIF}
end;
@ -629,7 +624,7 @@ begin
result := sysutils.GetEnvironmentVariable('HOME') + '/.config';
{$ENDIF}
{$IFDEF DARWIN}
result := sysutils.GetEnvironmentVariable('HOME') + '/Library';
result := sysutils.GetEnvironmentVariable('HOME') + '/Library/Application Support';
{$ENDIF}
if not DirectoryExists(result) then
raise Exception.Create('Coedit failed to retrieve the user data folder');
@ -806,7 +801,6 @@ begin
Free;
end;
{$ENDIF}
end;
function exeInSysPath(anExeName: string): boolean;
@ -1159,13 +1153,13 @@ procedure deleteDups(str: TStrings);
var
i: integer;
begin
{$HINTS OFF}
{$PUSH}{$HINTS OFF}
if str = nil then exit;
for i:= str.Count-1 downto 0 do
// if less than 0 -> not found -> unsigned -> greater than current index.
if cardinal(str.IndexOf(str[i])) < i then
str.Delete(i);
{$HINTS ON}
{$POP}
end;
initialization

View File

@ -626,7 +626,7 @@ begin
begin
str := binKindStr[fBinKind];
if str.isNotEmpty then aList.Add(str);
{$IFDEF UNIX}
{$IFNDEF WINDOWS}
if fBinKind = sharedlib then
aList.Add('-fPIC');
{$ENDIF}
@ -659,7 +659,7 @@ begin
if (str <> strbase) then
begin
aList.Add(str);
{$IFDEF UNIX}
{$IFNDEF WINDOWS}
if fBinKind = sharedlib then
aList.Add('-fPIC');
{$ENDIF}
@ -667,7 +667,7 @@ begin
else
begin
aList.Add(strbase);
{$IFDEF UNIX}
{$IFNDEF WINDOWS}
if baseopt.fBinKind = sharedlib then
aList.Add('-fPIC');
{$ENDIF}

View File

@ -826,8 +826,7 @@ begin
if conf.isNotNil then
setFrom(conf);
pathPart := TrimRightSet(pathPart, ['/','\']);
{$IFDEF WINDOWS}
{$ELSE}
{$IFNDEF WINDOWS}
if fBinKind in [staticlib, sharedlib] then
namePart := 'lib' + namePart;
{$ENDIF}

View File

@ -111,15 +111,31 @@ begin
end;
{$ENDIF}
{$IFDEF DARWIN}
assert(false, 'to be implemented');
if '/Library/D/dmd/src/phobos'.dirExists then
begin
with TLibraryItem(fCol.Add) do begin
libAlias := 'phobos';
libFile := '';
libSourcePath := '/Library/D/dmd/src/phobos';
end;
end;
// add druntime (no lib - only for DCD)
if '/Library/D/dmd/src/druntime/import'.dirExists then
begin
with TLibraryItem(fCol.Add) do begin
libAlias := 'druntime';
libFile := '';
libSourcePath := '/Library/D/dmd/src/druntime/import';
end;
end;
{$ENDIF}
end;
if fCol.Count = 0 then
if (fCol.Count = 0) and not (getCoeditDocPath + libFname).fileExists then
begin
dlgOkError(
'Coedit failed to automatically add "druntime" and "phobos" to the library manager.'
+ 'These two items have to be added manually following the procedure described in the wiki.'
);
dlgOkInfo(
'Coedit failed to add "druntime" and "phobos" to the library manager.'
+ 'If they are not already specified in the DCD configuration then the '
+ 'completion will not work properly');
end;
updateDCD;
end;

View File

@ -1937,7 +1937,7 @@ begin
fRunProc.OnTerminate:= @asyncprocTerminate;
end else
begin
{$IFDEF LINUX}
{$IFNDEF WINDOWS}
fRunProc.Options := fRunProc.Options + [poNewConsole];
{$ENDIF}
end;

View File

@ -661,7 +661,7 @@ var
str: string;
begin
result := false;
{$IFDEF LINUX}
{$IFNDEF WINDOWS}
if (aPath.length >= 2) and (aPath[2] <> '/') then
aPath := '/' + aPath;
{$ENDIF}

View File

@ -150,7 +150,7 @@ begin
subjProjNew(fProjectSubject, self);
subjProjChanged(fProjectSubject, self);
//
{$IFDEF LINUX}
{$IFNDEF WINDOWS}
fBasePath := '/';
{$ENDIF}
//