[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch] FPC - fpc.cfg und ld finden



Dieser Patch für FPC sorgt dafür, dass er seine fpc.cfg im Verzeichnis
file:/packages/fpc/2.0.4/ sucht. Dort ist noch ein kleiner Hack im Code.
Aber sonst erkennt er das Verzeichnis nicht wirklich, müsste man mal
Debuggen. Liegt vermutlich an einem Stub. ;-)

Den LD sucht er fix in file:/system/lpt-bin/ld. Vielleicht könnte man da
noch etwas reinmachen um in $PATH zu suchen, aber ansich unnötig.

-- 
Antoine Kaufmann
<toni@xxxxxxxxxxxxxxxx>
diff -urN --exclude=Makefile --exclude='*.rst' --exclude='fpcmade.*' --exclude=link.res fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/globals.pas fpcbuild_2.0.4_exp/fpcsrc/compiler/globals.pas
--- fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/globals.pas	2008-08-28 19:04:34.000000000 +0200
+++ fpcbuild_2.0.4_exp/fpcsrc/compiler/globals.pas	2008-08-28 21:50:37.000000000 +0200
@@ -688,6 +688,34 @@
         FoundFile:=fn;
       end;
 
+{$ifdef LOST}
+    function c_fopen(filename, mode: PChar): longint; cdecl; external name 'fopen';
+    function c_fclose(f: longint): integer; cdecl; external name 'fclose';
+    Function LOSTPathExists (F : String) : Boolean;
+      Var
+        cfilename: String;
+        cmode: String;
+        I: longint;
+      begin
+        cfilename := F + #0;
+        cmode := 'r'#0;
+        I := c_fopen(@cfilename[1], @cmode[1]);
+        if I <> 0 then begin
+            c_fclose(I);
+            LOSTPathExists := true;
+            exit;
+        end;
+        cmode := 'rd'#0;
+        I := c_fopen(@cfilename[1], @cmode[1]);
+        if I <> 0 then begin
+            c_fclose(I);
+            LOSTPathExists := true;
+            exit;
+        end;
+        LOSTPathExists := false;
+      end;
+{$endif LOST}
+
 
     Function PathExists ( F : String) : Boolean;
       Var
@@ -703,6 +731,12 @@
             PathExists := true;
             exit;
           end;
+
+{$ifdef LOST}
+        PathExists := LOSTPathExists(F);
+        exit;
+{$endif LOST}
+
 {$ifdef USE_SYSUTILS}
         F := ExpandFileName(F);
 {$else USE_SYSUTILS}
diff -urN --exclude=Makefile --exclude='*.rst' --exclude='fpcmade.*' --exclude=link.res fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/options.pas fpcbuild_2.0.4_exp/fpcsrc/compiler/options.pas
--- fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/options.pas	2008-08-28 19:04:34.000000000 +0200
+++ fpcbuild_2.0.4_exp/fpcsrc/compiler/options.pas	2008-08-28 21:12:24.000000000 +0200
@@ -1318,11 +1318,11 @@
   If FileLevel>MaxLevel then
    Message(option_too_many_cfg_files);
 { Maybe It's Directory ?}   //Jaro Change:
-  if DirectoryExists(filename) then
+  {if DirectoryExists(filename) then
     begin
        Message1(option_config_is_dir,filename);
        exit;
-    end;
+    end;}
 { open file }
   Message1(option_using_file,filename);
 {$ifdef USE_SYSUTILS}
@@ -1748,10 +1748,16 @@
        foundfn:=configpath+fn
      else
 {$ifndef Unix}
+{$ifndef LOST}
       if CfgFileExists(exepath+fn) then
        foundfn:=exepath+fn
      else
 {$else}
+      if CfgFileExists('file:/packages/fpc/2.0.4/'+fn) then
+       foundfn:='file:/packages/fpc/2.0.4/'+fn
+     else
+{$endif}
+{$else}
       if CfgFileExists('/etc/'+fn) then
        foundfn:='/etc/'+fn
      else
diff -urN --exclude=Makefile --exclude='*.rst' --exclude='fpcmade.*' --exclude=link.res fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/systems/t_lost_old.pas fpcbuild_2.0.4_exp/fpcsrc/compiler/systems/t_lost_old.pas
--- fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/systems/t_lost_old.pas	2008-08-29 10:56:30.000000000 +0200
+++ fpcbuild_2.0.4_exp/fpcsrc/compiler/systems/t_lost_old.pas	1970-01-01 01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
-{
-    Copyright (c) 1998-2002 by Peter Vreman
-
-    This unit implements support import,export,link routines
-    for the (i386) Linux target
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ****************************************************************************
-}
-unit t_lost;
-
-{$i fpcdefs.inc}
-
-interface
-    
-implementation    
-    uses
-       link,
-       cutils,cclasses,
-       globtype,globals,systems,verbose,script,fmodule,i_lost;
-
-initialization
-  RegisterTarget(system_i386_lost_info);
-end.
diff -urN --exclude=Makefile --exclude='*.rst' --exclude='fpcmade.*' --exclude=link.res fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/systems/t_lost.pas fpcbuild_2.0.4_exp/fpcsrc/compiler/systems/t_lost.pas
--- fpcbuild_2.0.4_exp.orig/fpcsrc/compiler/systems/t_lost.pas	2008-08-29 10:56:30.000000000 +0200
+++ fpcbuild_2.0.4_exp/fpcsrc/compiler/systems/t_lost.pas	2008-08-29 17:16:37.000000000 +0200
@@ -212,7 +212,7 @@
 {$ifdef x86_64}
    LibrarySearchPath.AddPath('/lib64;/usr/lib64;/usr/X11R6/lib64',true);
 {$else}
-   LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
+   LibrarySearchPath.AddPath('file:/system/lib',true);
 {$endif x86_64}
 end;
 
@@ -223,13 +223,13 @@
 }
 
 const
-{$ifdef i386}   platform_select='-b elf32-i386 -m elf_i386';{$endif} 
+{$ifdef i386}   platform_select='';{$endif} 
 {$ifdef x86_64} platform_select='-b elf64-x86-64 -m elf_x86_64';{$endif}
 
 begin
   with Info do
    begin
-     ExeCmd[1]:='ld -Ttext=0x40000000 '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
+     ExeCmd[1]:='file:/system/lpt-bin/ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES -lc -lgcc';
      DllCmd[1]:='ld '+platform_select+' $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES -E';
      DllCmd[2]:='strip --strip-unneeded $EXE';
 
@@ -354,13 +354,13 @@
   if prtobj<>'' then
    LinkRes.AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
   { try to add crti and crtbegin if linking to C }
-  if linklibc then
+  {if linklibc then
    begin
      if librarysearchpath.FindFile('crtbegin.o',s) then
       LinkRes.AddFileName(s);
      if librarysearchpath.FindFile('crti.o',s) then
       LinkRes.AddFileName(s);
-   end;
+   end;}
   { main objectfiles }
   while not ObjectFiles.Empty do
    begin
@@ -402,13 +402,9 @@
            linklibc:=true;
          end;
       end;
-     { be sure that libc is the last lib }
-     if linklibc then
+      { Wir linken immer gegen die Libc }
       LinkRes.Add('-lc');
-     { when we have -static for the linker the we also need libgcc }
-     if (cs_link_staticflag in aktglobalswitches) then
       LinkRes.Add('-lgcc');
-     LinkRes.Add(')');
    end;
 
   { objects which must be at the end }

Attachment: pgpeFzR7z22x6.pgp
Description: PGP signature