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

View File

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

View File

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

View File

@ -111,15 +111,31 @@ begin
end; end;
{$ENDIF} {$ENDIF}
{$IFDEF DARWIN} {$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} {$ENDIF}
end; end;
if fCol.Count = 0 then if (fCol.Count = 0) and not (getCoeditDocPath + libFname).fileExists then
begin begin
dlgOkError( dlgOkInfo(
'Coedit failed to automatically add "druntime" and "phobos" to the library manager.' 'Coedit failed to add "druntime" and "phobos" to the library manager.'
+ 'These two items have to be added manually following the procedure described in the wiki.' + 'If they are not already specified in the DCD configuration then the '
); + 'completion will not work properly');
end; end;
updateDCD; updateDCD;
end; end;

View File

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

View File

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

View File

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