2
0
Эх сурвалжийг харах

* cygdrive support
* fixed cygwin detection
* fixed some duplicate and extraeous spaces

peter 24 жил өмнө
parent
commit
dbfa9b5cc1

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 189 - 182
utils/fpcm/fpcmake.inc


+ 9 - 1
utils/fpcm/fpcmake.ini

@@ -53,7 +53,7 @@ inOS2=1
 endif
 endif
 else
-ifneq ($(findstring cygwin,$(MACH_TYPE)),)
+ifneq ($(findstring cygwin,$(MACHTYPE)),)
 inCygWin=1
 endif
 endif
@@ -80,6 +80,14 @@ endif
 # Base dir
 ifdef PWD
 BASEDIR:=$(subst \,/,$(shell $(PWD)))
+# For Cygwin we need to replace /cygdrive/c/ with c:/
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
 else
 BASEDIR=.
 endif

+ 7 - 2
utils/fpcm/fpcmake.pp

@@ -142,7 +142,7 @@ program fpcmake;
           { Load Makefile.fpc }
           CurrFPCMake:=TFPCMakeConsole.Create(fn);
           CurrFPCMake.LoadMakefileFPC;
-          CurrFPCMake.Print;
+//          CurrFPCMake.Print;
 
           { Write Package.fpc }
           CurrPackageFpc:=TPackageFpcWriter.Create(CurrFPCMake,ExtractFilePath(fn)+'Package.fpc');
@@ -251,7 +251,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2001-06-04 21:42:57  peter
+  Revision 1.5  2001-07-13 21:01:59  peter
+    * cygdrive support
+    * fixed cygwin detection
+    * fixed some duplicate and extraeous spaces
+
+  Revision 1.4  2001/06/04 21:42:57  peter
     * Arguments added
     * Start of Package.fpc creation
 

+ 26 - 7
utils/fpcm/fpcmmain.pp

@@ -79,6 +79,7 @@ interface
         destructor  Destroy;override;
         procedure AddLine(const s:string);
         procedure AddKey(const k,v:string);
+        procedure Clear;
         procedure ParseIni;
         procedure BuildIni;
         procedure BuildMakefile;
@@ -116,11 +117,11 @@ interface
         function  CopySection(Sec:TFPCMakeSection;Secname:string):TFPCMakeSection;
       protected
         VerboseIdent : string;
-        procedure Verbose(lvl:TFPCMakeVerbose;const s:string);virtual;
       public
         constructor Create(const AFileName:string);
         constructor CreateFromStream(s:TStream;const AFileName:string);
         destructor  Destroy;override;
+        procedure Verbose(lvl:TFPCMakeVerbose;const s:string);virtual;
         procedure LoadSections;
         procedure LoadMakefileFPC;
         procedure LoadPackageSection;
@@ -300,6 +301,15 @@ implementation
       end;
 
 
+    procedure TFPCMakeSection.Clear;
+      begin
+        FList.Free;
+        FList:=TStringList.Create;
+        FDictionary.Free;
+        FDictionary:=nil;
+      end;
+
+
     procedure TFPCMakeSection.AddLine(const s:string);
       begin
         if FList=nil then
@@ -530,8 +540,9 @@ implementation
         Result:=TFPCMakeSection(FSections[SecName]);
         if Sec=Nil then
          exit;
+        { Clear old section or if not existing create new }
         if assigned(Result) then
-         Result.BuildIni
+         Result.Clear
         else
          Result:=TFPCMakeSection(FSections.Insert(TFPCMakeSection.Create(SecName)));
         Sec.BuildIni;
@@ -685,7 +696,7 @@ implementation
           { Load the requirements of this package }
           LoadRequires(t,ReqFPCMake);
           { Add the current requirements to our parents requirements }
-          s:=ReqFPCMake.GetVariable('require_packages',true)+' '+ReqFPCMake.GetVariable('require_packages'+targetsuffix[t],true);
+          s:=Trim(ReqFPCMake.GetVariable('require_packages',true)+' '+ReqFPCMake.GetVariable('require_packages'+targetsuffix[t],true));
           SetVariable('require_packages'+targetsuffix[t],s,true);
           if ReqFPCMake.GetVariable('require_libc',false)<>'' then
            SetVariable('require_libc','y',false);
@@ -704,7 +715,7 @@ implementation
         i,j : integer;
       begin
         { packages }
-        s:=FromFPCMake.GetVariable('require_packages',true)+' '+FromFPCMake.GetVariable('require_packages'+TargetSuffix[t],true);
+        s:=Trim(FromFPCMake.GetVariable('require_packages',true)+' '+FromFPCMake.GetVariable('require_packages'+TargetSuffix[t],true));
         Verbose(FPCMakeDebug,'Required packages for '+TargetStr[t]+': '+s);
         repeat
           reqname:=GetToken(s);
@@ -1131,8 +1142,11 @@ implementation
            p:=TKeyValueItem(Sec.Dictionary.Search(Key));
            if assigned(p) then
             begin
-              if Add then
-               p.Value:=p.Value+' '+Value
+              if Add and (p.Value<>'') then
+               begin
+                 if Value<>'' then
+                  p.Value:=p.Value+' '+Value;
+               end
               else
                p.Value:=Value;
             end
@@ -1202,7 +1216,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.7  2001-06-04 21:42:57  peter
+  Revision 1.8  2001-07-13 21:01:59  peter
+    * cygdrive support
+    * fixed cygwin detection
+    * fixed some duplicate and extraeous spaces
+
+  Revision 1.7  2001/06/04 21:42:57  peter
     * Arguments added
     * Start of Package.fpc creation
 

+ 32 - 2
utils/fpcm/fpcmpkg.pp

@@ -31,6 +31,7 @@ interface
         constructor Create(AFPCMake:TFPCMake;const AFileName:string);
         destructor  Destroy;override;
         procedure WritePackageFpc;
+        procedure AddSection(const s:string);
       end;
 
 
@@ -69,22 +70,51 @@ implementation
       end;
 
 
+    procedure TPackageFpcWriter.AddSection(const s:string);
+      var
+        Sec : TFPCMakeSection;
+      begin
+        Sec:=TFPCMakeSection(FInput[s]);
+        if assigned(Sec) then
+         begin
+           Sec.BuildIni;
+           FOutput.Add('['+s+']');
+           FOutput.AddStrings(Sec.List);
+         end;
+      end;
+
+
     procedure TPackageFpcWriter.WritePackageFpc;
       begin
-        FInput.Print;
+        { Only write the Package.fpc if the package is
+          section available }
+        if not assigned(FInput['package']) then
+         begin
+           FInput.Verbose(FPCMakeInfo,'Not writing Package.fpc, no package section');
+           exit;
+         end;
 
         { Generate Output }
         with FOutput do
          begin
+           AddSection('package');
+           AddSection('require');
          end;
+
         { write to disk }
+        FInput.Verbose(FPCMakeInfo,'Writing Package.fpc');
         FOutput.SaveToFile(FFileName);
       end;
 
 end.
 {
   $Log$
-  Revision 1.1  2001-06-04 21:42:57  peter
+  Revision 1.2  2001-07-13 21:01:59  peter
+    * cygdrive support
+    * fixed cygwin detection
+    * fixed some duplicate and extraeous spaces
+
+  Revision 1.1  2001/06/04 21:42:57  peter
     * Arguments added
     * Start of Package.fpc creation
 

+ 7 - 1
utils/fpcm/fpcmwr.pp

@@ -855,6 +855,7 @@ implementation
             AddStrings(TFPCMakeSection(FInput['rules']).List);
          end;
         { write to disk }
+        FInput.Verbose(FPCMakeInfo,'Writing Makefile');
         Fixtab(FOutput);
         FOutput.SaveToFile(FFileName);
       end;
@@ -862,7 +863,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.12  2001-06-07 21:21:38  peter
+  Revision 1.13  2001-07-13 21:01:59  peter
+    * cygdrive support
+    * fixed cygwin detection
+    * fixed some duplicate and extraeous spaces
+
+  Revision 1.12  2001/06/07 21:21:38  peter
     * remove ppufiles
     * fix staticlib prefix that is now libp instead of lib
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно