bug 3626
Allan CORNET [Mon, 3 Nov 2008 08:43:15 +0000 (09:43 +0100)]
scilab/CHANGES_5.1
scilab/modules/dynamic_link/macros/VCtoLCCLib.sci
scilab/modules/dynamic_link/macros/configure_lcc.sci
scilab/modules/dynamic_link/macros/ilib_for_link.sci
scilab/modules/dynamic_link/macros/ilib_gen_Make.sci
scilab/modules/scicos/macros/scicos_scicos/buildnewblock.sci

index 3359170..3d055a2 100644 (file)
@@ -97,4 +97,6 @@ Bug fixes:
 
 * bug 3571 fixed - Only one message displayed when log(0) is computed with ieee(1) mode.
 
-* bug 2273 fixed - chdir didn't manage UNC path on Windows
\ No newline at end of file
+* bug 2273 fixed - chdir didn't manage UNC path on Windows.
+
+* bug 3626 fixed - lcc-win32 library (.lib) not correctly generated.
index 1ed124e..fa68c81 100644 (file)
 //==========================================
 // Export Libraries of Scilab for LCC compiler
 //==========================================
-function VCtoLCCLib()
+function bOK = VCtoLCCLib()
   // LCC-Win32 only on Windows
   if (findlcccompiler() == %T) then
+    bOK = [];
                DirCur = pwd();
-               chdir(WSCI+'\bin');
                
-               status = mkdir('lcclib');
-               if (status == 1) | (status == 2) then
-                 Exportalibrary('LibScilab');
-                 Exportalibrary('libf2c');
-                 ExportAtlasLibrary();
-                 Exportalibrary('lapack');
-                 Exportalibrary('scicos');
-                 Exportalibrary('intersci');
-                 Exportalibrary('dynamic_link');
-                 Exportalibrary('scioutput_stream');
-                 Exportalibrary('MALLOC');
-                 Exportalibrary('libintl');
+         bOK = [bOK , ExportAtlasLibrary('blasplus', WSCI+'\bin')];
+               bOK = [bOK , Exportalibrary('LibScilab', WSCI+'\bin')];
+               bOK = [bOK , Exportalibrary('libf2c', WSCI+'\bin')];
+               bOK = [bOK , Exportalibrary('lapack', WSCI+'\bin')];
+               if with_module('scicos') then
+                 bOK = [bOK , Exportalibrary('scicos', WSCI+'\bin')];
+                 bOK = [bOK , Exportalibrary('scicos_f', WSCI+'\bin')];
+                 bOK = [bOK , Exportalibrary('scicos_blocks', WSCI+'\bin')];
+                 bOK = [bOK , Exportalibrary('scicos_blocks_f', WSCI+'\bin')];
                end
-       
+               bOK = [bOK , Exportalibrary('intersci', WSCI+'\bin')];
+               bOK = [bOK , Exportalibrary('dynamic_link', WSCI+'\bin')];
+               bOK = [bOK , Exportalibrary('scioutput_stream', WSCI+'\bin')];
+         bOK = [bOK , Exportalibrary('MALLOC', WSCI+'\bin')];
+         bOK = [bOK , Exportalibrary('libintl', WSCI+'\bin')];
+               
                chdir(DirCur);
+               
+               if and(bOK == %T) then
+                 bOK = %t;
+               end
+               
+       else
+         bOK = %f;
        end
-
+  
 endfunction
 //==========================================
-function bOK = Exportalibrary(libraryname)
-  printf('\nExports from '+libraryname+'.dll\n');
-       unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
-       printf('Converting Library');
+function  bOK = ExportAtlasLibrary(libraryname, pathlib)
+
+  destPath = SCIHOME + filesep() + 'lcclib';
+  mkdir(destPath);
+  if chdir(pathlib) == %f then 
+    bOK = %f;
+    return
+  end
+  
+  mprintf('\nExports from '+libraryname+'.dll\n');
+  ierr = unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
+  if ierr <> 0 then
+         bOK=%F;       
+         return;
+       end
+       
+       mprintf('Converting Library');
        
        fw = mopen(TMPDIR+filesep()+libraryname+'.exp',"wt");
        fr = mopen(TMPDIR+filesep()+libraryname+'.lcc',"rt");
        
        if (meof(fr) == 0) then 
                line = mfscanf(1,fr,"%s");
-               mfprintf(fw,"%s\n",line);
-               printf('.');
+               mfprintf(fw,"blasplus.dll\n");
        end
 
+       i=1;
        while ( meof(fr) == 0)
                line = mfscanf(1,fr,"%s");
                if (line ~= []) then
-                       mfprintf(fw,"_%s\n",line);
-               end
+                       mfprintf(fw,"_%s_  %s @%d\n",line,line,i);
+                       i=i+1;
+                       end
        end
-
+               
        mclose(fw);
        mclose(fr);
-       printf('\n');
-       printf(gettext('Build %s.lib (Please waiting).\n'),libraryname);
-       command = 'buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+WSCI+'\bin\lcclib\'+libraryname+'.lib""';
-       unix(command);
-       bOK=%T;
+       
+       mprintf('\n');
+       mprintf(gettext('Build %s.lib (Please waiting).\n'),libraryname);
+       command = 'buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+destPath+filesep()+libraryname+'lcc.lib""';
+       ierr = unix(command);
+       if ierr <> 0 then
+         bOK=%F;       
+         return;
+       end
+       
+       if fileinfo(destPath+filesep()+libraryname+'.lib') <> [] then
+         bOK=%T;
+       else
+         bOK=%F;       
+       end
 endfunction
 //==========================================
-function ExportAtlasLibrary()
+function bOK = Exportalibrary(libraryname, pathlib)
+  destPath = SCIHOME + filesep() + 'lcclib';
+  mkdir(destPath);
+
+  if chdir(pathlib) == %f then 
+    bOK = %f;
+    return
+  end
+  
+  mprintf('\nExports from '+libraryname+'.dll\n');
+  ierr = unix('pedump /exp '+libraryname+'.dll >'+TMPDIR+filesep()+libraryname+'.lcc');
+  if ierr <> 0 then
+         bOK=%F;       
+         return;
+       end
        
-       printf('\n');
-       printf(gettext('Exports from blasplus.dll\n'));
-       unix('pedump /exp blasplus.dll >'+TMPDIR+'\blasplus.lcc');
-       printf(gettext('Converting Library'));
+       mprintf('Converting Library');
+       
+       fw = mopen(TMPDIR+filesep()+libraryname+'.exp',"wt");
+       fr = mopen(TMPDIR+filesep()+libraryname+'.lcc',"rt");
        
-       fw = mopen(TMPDIR+'\blaspluslcc.exp',"wt");
-       fr = mopen(TMPDIR+'\blasplus.lcc',"rt");
-
        if (meof(fr) == 0) then 
                line = mfscanf(1,fr,"%s");
-               mfprintf(fw,"blasplus.dll\n");
+               mfprintf(fw,"%s\n",line);
        end
 
-       i=1;
        while ( meof(fr) == 0)
                line = mfscanf(1,fr,"%s");
                if (line ~= []) then
-                       mfprintf(fw,"_%s_  %s @%d\n",line,line,i);
-                       i=i+1;
-                       end
+                       mfprintf(fw,"_%s\n",line);
+               end
        end
-
+       
        mclose(fw);
        mclose(fr);
-       printf('\n');
-       printf(gettext('Build %s.lib (Please waiting).\n'),'Atlas');
-       unix('buildLib ""'+TMPDIR+'\Atlaslcc.exp""'+' ""'+WSCI+'\bin\lcclib\'+'blasplus.lib""');
+       
+       mprintf('\n');
+       mprintf(gettext('Build %s.lib (Please waiting).\n'),libraryname);
+       command = 'buildLib ""'+TMPDIR+filesep()+libraryname+'.exp""'+' ""'+destPath+filesep()+libraryname+'lcc.lib""';
+       ierr = unix(command);
+       if ierr <> 0 then
+         bOK=%F;       
+         return;
+       end
+       
+       if fileinfo(destPath+filesep()+libraryname+'.lib') <> [] then
+         bOK=%T;
+       else
+         bOK=%F;       
+       end
+
 endfunction
-//==========================================
+//==========================================
\ No newline at end of file
index d597682..203aba0 100644 (file)
@@ -40,12 +40,12 @@ function bOK = configure_lcc()
       err = setenv('PATH',NEWPATH);
       if (err == %F) then bOK = %F,return,end
       
-      LCCLIB_DIR = SCI+'/bin/lcclib';
+      LCCLIB_DIR = SCIHOME+'\lcclib';
       
       if ( (fileinfo(LCCLIB_DIR) == []) | ( findfiles(LCCLIB_DIR,'*.lib') == []) ) then
-        printf('\n');
-        printf(gettext('%s: Converts libraries to use LCC-Win32.\n'),'configure_lcc')
-        bOK = call_VCtoLCCLib();
+        mprintf('\n');
+        mprintf(gettext('%s: Converts libraries to use LCC-Win32.\n'),'configure_lcc')
+        bOK =  VCtoLCCLib();
       else
         bOK = %T;
       end
@@ -57,12 +57,3 @@ function bOK = configure_lcc()
   
 endfunction
 //==========================================
-function r = call_VCtoLCCLib()
-  try
-    VCtoLCCLib();
-    r = %T;
-  catch
-    r = %F;
-  end
-endfunction
-//==========================================
index d1fcdf8..5ab1732 100644 (file)
@@ -302,11 +302,12 @@ function ilib_link_gen_Make_lcc(names, ..
   mfprintf(fd,"# ------------------------------------------------------------\n\n");
   mfprintf(fd,"SCIDIR = %s\n",SCI);
   mfprintf(fd,"SCIDIR1 = %s\n",pathconvert(SCI,%f,%f,'w'));
+  mfprintf(fd,"LCCLIBDIR =%s\n",getshortpathname(SCIHOME+filesep()+'lcclib'));
   mfprintf(fd,"DUMPEXTS = ""$(SCIDIR1)\\bin\\dumpexts""\n");
-  mfprintf(fd,"SCIIMPLIB = $(SCIDIR1)\\bin\\lcclib\\LibScilab.lib $(SCIDIR1)\\bin\\lcclib\\blasplus.lib $(SCIDIR1)\\bin\\lcclib\\libf2c.lib $(SCIDIR1)\\bin\\lcclib\\intersci.lib $(SCIDIR1)\\bin\\lapack.lib $(SCIDIR1)\\bin\\scicos.lib\n\n");
+  mfprintf(fd,"SCIIMPLIB=$(LCCLIBDIR)\\LibScilab.lib $(LCCLIBDIR)\\blasplus.lib $(LCCLIBDIR)\\libf2c.lib $(LCCLIBDIR)\\intersci.lib $(LCCLIBDIR)\\lapack.lib $(LCCLIBDIR)\\scicos.lib\n\n");
   mfprintf(fd,"CC = lcc\n");
   mfprintf(fd,"LINKER = lcclnk\n");
-  mfprintf(fd,"CFLAGS = -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ -DHAVE_EXP10 "+ cflags +" \n"); 
+  mfprintf(fd,"CFLAGS= -ansic msvcrt.lib -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/modules/output_stream/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__  -DHAVE_EXP10"+ cflags +" \n"); 
   mfprintf(fd,"LINKER_FLAGS = -dll -nounderscores\n");
   mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");
   mfprintf(fd,"O=.obj\n");
@@ -345,27 +346,27 @@ function ilib_link_gen_Make_lcc(names, ..
   
   mfprintf(fd,"\nall :: $(LIBRARY).dll\n");
   mfprintf(fd,"\n$(LIBRARY).dll: $(OBJS)\n");
-  mfprintf(fd,"        $(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
-  mfprintf(fd,"        $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
+  mfprintf(fd,"\t"+"$(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
+  mfprintf(fd,"\t"+"$(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
  
   for x = files(:)' 
     [ptmp,ftmp,fext] = fileparts(x);
     x = ptmp + ftmp;
        mfprintf(fd,"%s$(O):\n",x);
        if (flag =='c') then
-               mfprintf(fd,"   $(CC) $(CFLAGS) $*.c\n\n");
+               mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n\n");
        else
-               mfprintf(fd,"   @$(SCIDIR1)\\bin\\f2c.exe $*.f \n");
-                 mfprintf(fd," @$(CC) $(CFLAGS) $*.c \n");
-                 mfprintf(fd," del $*.c \n");
+               mfprintf(fd,"\t"+"@$(SCIDIR1)\\bin\\f2c.exe $*.f \n");
+                 mfprintf(fd,"\t"+"@$(CC) $(CFLAGS) $*.c \n");
+                 mfprintf(fd,"\t"+"del $*.c \n");
          end
   end
        
   mfprintf(fd,"clean:\n");
-  mfprintf(fd,"        del *.obj\n");
-  mfprintf(fd,"        del *.dll\n");
-  mfprintf(fd,"        del *.lib\n");
-  mfprintf(fd,"        del *.def\n");
+  mfprintf(fd,"\t"+"del *.obj\n");
+  mfprintf(fd,"\t"+"del *.dll\n");
+  mfprintf(fd,"\t"+"del *.lib\n");
+  mfprintf(fd,"\t"+"del *.def\n");
  
   mclose(fd);
 endfunction
index 2f72fa6..c308ae2 100644 (file)
@@ -150,19 +150,25 @@ function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,c
       files(i) = path_f + file_f + ext_f;
     end
   end
+  
+  if with_module('scicos') then
+    scicoslib = '$(LCCLIBDIR)\\scicoslcc.lib $(LCCLIBDIR)\\scicos_flcc.lib $(LCCLIBDIR)\\scicos_blockslcc.lib  $(LCCLIBDIR)\\scicos_blocks_flcc.lib';
+  else
+    scicoslib = '';
+  end
 
   fd=mopen(Makename,"w");
   mfprintf(fd,"# ------------------------------------------------------------\n");
   mfprintf(fd,"# generated by builder.sce (lcc 1): Please do not edit this file\n");
   mfprintf(fd,"# ------------------------------------------------------------\n\n");
   mfprintf(fd,"SCIDIR =%s\n",SCI);
+  mfprintf(fd,"LCCLIBDIR =%s\n",getshortpathname(SCIHOME+filesep()+'lcclib'));
   mfprintf(fd,"SCIDIR1 =%s\n",pathconvert(SCI,%f,%f,'w'));
   mfprintf(fd,"DUMPEXTS=""$(SCIDIR1)\\bin\\dumpexts""\n");
-       mfprintf(fd,"SCIIMPLIB=$(SCIDIR1)\\bin\\lcclib\\LibScilab.lib $(SCIDIR1)\\bin\\lcclib\\blasplus.lib $(SCIDIR1)\\bin\\lcclib\\libf2c.lib $(SCIDIR1)\\bin\\interscilcc.lib $(SCIDIR1)\\bin\\lcclib\\lapack.lib $(SCIDIR1)\\bin\\lcclib\\scicos.lib\n\n");
+       mfprintf(fd,"SCIIMPLIB=$(LCCLIBDIR)\\LibScilablcc.lib $(LCCLIBDIR)\\blaspluslcc.lib $(LCCLIBDIR)\\libf2clcc.lib $(LCCLIBDIR)\\interscilcc.lib $(LCCLIBDIR)\\lapacklcc.lib " + scicoslib +"\n\n");
   mfprintf(fd,"CC=lcc\n");
   mfprintf(fd,"LINKER=lcclnk\n");
-  mfprintf(fd,"CFLAGS= -ansic msvcrt.lib -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ "+ cflags +" \n"); 
-  
+  mfprintf(fd,"CFLAGS= -ansic msvcrt.lib -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/modules/output_stream/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ "+ cflags +" \n"); 
   mfprintf(fd,"LINKER_FLAGS=-dll -nounderscores\n");
   mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");
   mfprintf(fd,"O=.obj\n");
@@ -210,8 +216,8 @@ function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,c
   
   mfprintf(fd,"\nall :: $(LIBRARY).dll\n");
   mfprintf(fd,"\n$(LIBRARY).dll: $(OBJS)\n");
-  mfprintf(fd,"        $(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
-  mfprintf(fd,"        $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(XLIBSBIN) $(TERMCAPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
+  mfprintf(fd,"\t"+"$(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
+  mfprintf(fd,"\t"+"$(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(XLIBSBIN) $(TERMCAPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
 
   for x=files(:)' ;
     managed_ext_obj = ['.obj','.o'];
@@ -222,26 +228,26 @@ function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,c
       files(i) = path_f + file_f + ext_f;
     end
        mfprintf(fd,"%s$(O):\n",x);
-       mfprintf(fd,"   $(CC) $(CFLAGS) $*.c\n\n");
+       mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n\n");
   end
 
   if with_gateway then 
     if L==1 then 
       mfprintf(fd,"\n%s$(O):\n",name);
-      mfprintf(fd,"    $(CC) $(CFLAGS) $*.c\n");
+      mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n");
     else
        for i=1:L ;
        mfprintf(fd,"\n%s$(O):\n",name+string(i));
-       mfprintf(fd,"   $(CC) $(CFLAGS) $*.c\n");
+       mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n");
        end 
     end
   end
   
   mfprintf(fd,"\nclean:\n");
-  mfprintf(fd,"        del *.obj\n");
-  mfprintf(fd,"        del *.dll\n");
-  mfprintf(fd,"        del *.lib\n");
-  mfprintf(fd,"        del *.def\n");
+  mfprintf(fd,"\t"+"del *.obj\n");
+  mfprintf(fd,"\t"+"del *.dll\n");
+  mfprintf(fd,"\t"+"del *.lib\n");
+  mfprintf(fd,"\t"+"del *.def\n");
  
  mclose(fd);
 
index 3afd194..120d9c8 100644 (file)
@@ -482,12 +482,12 @@ function T=gen_make_lccwin32(blknam,files,filestan,libs,ldflags,cflags)
      "SCIDIR            = "+SCI
      "SCIDIR1           = "+WSCI
      "DUMPEXTS          = """+WSCI+"\bin\dumpexts"""
-     "SCIIMPLIB         = """+WSCI+"\bin\lcclib\LibScilablcc.lib"""
-     "SCILIBS           = """+WSCI+"\bin\lcclib\LibScilablcc.lib"""
-     "SCICOSCLIB        = """+WSCI+"\bin\lcclib\scicoslcc.lib"""
-     "SCICOSFLIB        = """+WSCI+"\bin\lcclib\scicos_flcc.lib"""
-     "SCICOS_BLOCKSCLIB = """+WSCI+"\bin\lcclib\scicos_blockslcc.lib"""
-     "SCICOS_BLOCKSFLIB = """+WSCI+"\bin\lcclib\scicos_blocks_flcc.lib"""
+     "SCIIMPLIB         = """+SCIHOME+"\lcclib\LibScilablcc.lib"""
+     "SCILIBS           = """+SCIHOME+"\lcclib\LibScilablcc.lib"""
+     "SCICOSCLIB        = """+SCIHOME+"\lcclib\scicoslcc.lib"""
+     "SCICOSFLIB        = """+SCIHOME+"\lcclib\scicos_flcc.lib"""
+     "SCICOS_BLOCKSCLIB = """+SCIHOME+"\lcclib\scicos_blockslcc.lib"""
+     "SCICOS_BLOCKSFLIB = """+SCIHOME+"\lcclib\scicos_blocks_flcc.lib"""
      "LIBRARY      = lib"+blknam
      "CC           = lcc"
      "LINKER       = lcclnk"