Browse Source

* Fix getlibraryfilename: do not add .so if output already contains it, do not add lib prefix if output already contains it. Take care of -o option

Michaël Van Canneyt 2 years ago
parent
commit
b83673ecf9
1 changed files with 14 additions and 2 deletions
  1. 14 2
      packages/fpmkunit/src/fpmkunit.pp

+ 14 - 2
packages/fpmkunit/src/fpmkunit.pp

@@ -9898,11 +9898,20 @@ end;
 
 
 function TTarget.GetBinFileBase: String;
+
+var
+  S : String;
+
 begin
   if FExeName <> '' then
     Result := FExeName
   else
+    begin
     Result:=Name;
+    for S in Options do
+      if Copy(S,1,2)='-o' then
+        Result:=Copy(S,3);
+    end;
 end;
 
 
@@ -9919,9 +9928,12 @@ end;
 
 function TTarget.GetLibraryFileName(AOS : TOS): String;
 begin
-  result := AddLibraryExtension(GetBinFileBase, AOS);
+  Result:=GetBinFileBase;
+  if ExtractFileExt(Result)='' then
+    result := AddLibraryExtension(Result, AOS);
   if aOS in AllUnixOSes then
-    Result:='lib'+Result;
+    if Copy(Result,1,3)<>'lib' then
+      Result:='lib'+Result;
 end;