cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2003-09-22 Thread hgomez
hgomez  2003/09/22 02:14:54

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  Clean import and fix a bugounet
  
  Revision  ChangesPath
  1.24  +29 -9 
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SoTask.java   9 Jun 2002 00:10:02 -   1.23
  +++ SoTask.java   22 Sep 2003 09:14:54 -  1.24
  @@ -54,14 +54,34 @@
   
   package org.apache.jk.ant;
   
  -import org.apache.tools.ant.types.*;
  -import org.apache.tools.ant.util.*;
  -import org.apache.tools.ant.taskdefs.*;
  -import org.apache.tools.ant.*;
  -import org.apache.jk.ant.compilers.*;
  -
  -import java.io.*;
  -import java.util.*;
  +import java.io.ByteArrayOutputStream;
  +import java.io.File;
  +import java.io.IOException;
  +import java.io.PrintStream;
  +import java.util.Enumeration;
  +import java.util.Vector;
  +
  +import org.apache.jk.ant.compilers.CcCompiler;
  +import org.apache.jk.ant.compilers.CompilerAdapter;
  +import org.apache.jk.ant.compilers.GcjCompiler;
  +import org.apache.jk.ant.compilers.GcjLinker;
  +import org.apache.jk.ant.compilers.LibtoolCompiler;
  +import org.apache.jk.ant.compilers.LibtoolLinker;
  +import org.apache.jk.ant.compilers.LinkerAdapter;
  +import org.apache.jk.ant.compilers.MsvcCompiler;
  +import org.apache.jk.ant.compilers.MsvcLinker;
  +import org.apache.jk.ant.compilers.MwccCompiler;
  +import org.apache.jk.ant.compilers.MwldLinker;
  +import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.DirectoryScanner;
  +import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.taskdefs.Execute;
  +import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
  +import org.apache.tools.ant.taskdefs.PumpStreamHandler;
  +import org.apache.tools.ant.types.Commandline;
  +import org.apache.tools.ant.types.FileSet;
  +import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.types.PatternSet;
   
   /** Global properties
   
  @@ -364,7 +384,7 @@
* (XXX including extension - this should be automatically added )
*/
   public void setModule(String modName) {
  -this.module = module;
  +this.module = modName;   // Should be this ?
   }
   
   // XXX Add specific code for Netware, Windows and platforms where libtool
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2002-06-08 Thread nacho

nacho   2002/06/08 17:10:02

  Modified:jk/jkant/java/org/apache/jk/ant/compilers MsvcCompiler.java
MsvcLinker.java
   jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  * Support for resource linking on win32
  
  XXX:Sorry for the tabs->spaces conversion in between :(
  
  Revision  ChangesPath
  1.6   +3 -0  
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcCompiler.java
  
  Index: MsvcCompiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcCompiler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MsvcCompiler.java 3 May 2002 05:24:17 -   1.5
  +++ MsvcCompiler.java 9 Jun 2002 00:10:02 -   1.6
  @@ -66,7 +66,10 @@
   /**
*  Compile using Microsoft Visual C++ v6.0
* 
  + * @author Costin Manolache
* @author Ignacio J. Ortega
  + * @author Mike Anderson
  + * @author Larry Isaacs
*/
   public class MsvcCompiler extends CompilerAdapter {
   GlobPatternMapper co_mapperS=new GlobPatternMapper();
  
  
  
  1.6   +14 -2 
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcLinker.java
  
  Index: MsvcLinker.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MsvcLinker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MsvcLinker.java   7 May 2002 19:45:08 -   1.5
  +++ MsvcLinker.java   9 Jun 2002 00:10:02 -   1.6
  @@ -67,7 +67,10 @@
   /**
* Link using MSVC Linker
*
  + * @author Costin Manolache
* @author Ignacio J. Ortega
  + * @author Mike Anderson
  + * @author Larry Isaacs
*/
   public class MsvcLinker extends LinkerAdapter {
   SoTask so;
  @@ -75,8 +78,8 @@
   
   public MsvcLinker() {
   so=this;
  - co_mapper.setFrom("*.c");
  - co_mapper.setTo("*.obj");
  +co_mapper.setFrom("*.c");
  +co_mapper.setTo("*.obj");
   }
   
   public void setSoTask(SoTask so ) {
  @@ -159,6 +162,15 @@
   if( targetNA!=null )
   linkOptPw.println( targetNA[0] );
   }
  +// Write the resources to link to .opt file
  +Enumeration ress = resources.elements();
  +while( ress.hasMoreElements() ) {
  +JkData res = (JkData) ress.nextElement();
  +String name = res.getValue();
  +if( name==null ) continue;
  +linkOptPw.println(name);
  +}
  +
   // Write the library name to the def file
   linkDefPw.println("LIBRARY\t\""+soFile+"\"");
   
  
  
  
  1.23  +194 -181  
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SoTask.java   12 Dec 2001 22:09:16 -  1.22
  +++ SoTask.java   9 Jun 2002 00:10:02 -   1.23
  @@ -99,6 +99,7 @@
*
* @author Costin Manolache
* @author Mike Anderson
  + * @author Ignacio J. Ortega
*/
   public class SoTask extends Task {
   protected String apxs;
  @@ -124,6 +125,7 @@
   protected Vector modules= new Vector(); // used by the NetWare linker
   protected Vector linkOpts   = new Vector(); // used by the NetWare, win32 
linkers
   protected Vector altSoFiles = new Vector(); // used by the NetWare linker
  +protected Vector resources  = new Vector(); // used by the win32 linker
   
   // Computed fields 
   //protected Vector compileList; // [Source]
  @@ -136,82 +138,83 @@
   // Hack to allow individual compilers/linkers to work
   // as regular Tasks, independnetly.
   public void duplicateTo(SoTask so) {
  - // This will act as a proxy for the child task 
  - so.project=project;
  - so.target=target;
  - so.location=location;
  - so.taskName=taskName;
  - so.taskType=taskType;
  - 
  - so.apxs=apxs;
  - so.src=src;
  - so.includes=includes;
  - so.depends=depends;
  - so.libs=libs;
  - so.module=module;
  - so.soFile=soFile;
  - so.soExt=soExt;
  - so.cflags=cflags;
  - so.buildDir=buildDir;
  - so.debug=debug;
  - so.optG=optG;
  +// This will act as a proxy for the child task 
  +so.project=project;
  +so.target=target;
  +so.location=location;
  +so.taskName=taskName;
  +so.taskType=taskType;
  +
  +so.apxs=apxs;
  +so.src=src;
  + 

cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2001-11-16 Thread costin

costin  01/11/16 14:18:50

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  SoTask will delegate to the CompilerAdapter the detection of files to
  be compiled.
  
  This simplifies things a bit and gives CompileAdapter a way to contol all
  files.
  
  Revision  ChangesPath
  1.21  +19 -97
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SoTask.java   2001/11/16 21:32:16 1.20
  +++ SoTask.java   2001/11/16 22:18:50 1.21
  @@ -125,10 +125,10 @@
   protected Vector altSoFiles = new Vector(); // used by the NetWare linker
   
   // Computed fields 
  -protected Vector compileList; // [Source]
  +//protected Vector compileList; // [Source]
   protected Vector srcList=new Vector();
   protected CompilerAdapter compiler;
  -protected GlobPatternMapper co_mapper;
  +//protected GlobPatternMapper co_mapper;
   
   public SoTask() {};
   
  @@ -162,9 +162,9 @@
so.modules=modules;
so.linkOpts=linkOpts;
so.srcList=srcList;
  - so.compileList=compileList;
  +//   so.compileList=compileList;
so.compiler=compiler;
  - so.co_mapper=co_mapper;
  +//   so.co_mapper=co_mapper;
so.altSoFiles=altSoFiles;
   }
   
  @@ -353,7 +353,7 @@
   // clean, libtool should be just a fallback.
   public void execute() throws BuildException {
compiler=findCompilerAdapter();
  - co_mapper=compiler.getOMapper();
  +//   co_mapper=compiler.getOMapper();
LinkerAdapter linker=findLinkerAdapter();
   
if( soFile==null )
  @@ -363,16 +363,20 @@
   
// XXX makedepend-type dependencies - how ??
// We could generate a dummy Makefile and parse the content...
  - findCompileList();
  +findSourceFiles();
   
  - compiler.compile( compileList );
  - 
  +// Copy all settings into compiler
  +this.duplicateTo(compiler);
  + compiler.compile( srcList );
  +
  +// XXX move this checking to linker
File soTarget=new File( buildDir, soFile + soExt );
  - if( compileList.size() == 0 && soTarget.exists()) {
  + if( compiler.getCompiledFiles().size() == 0 && soTarget.exists()) {
// No dependency, no need to relink
return;
}
   
  +this.duplicateTo(linker);
linker.link(srcList);
   }
   
  @@ -442,7 +446,8 @@
return linkerAdapter;
  }
   
  -
  +/** Find all source files declared with  elements
  + */
   public void findSourceFiles() {
if (buildDir == null) buildDir = project.getBaseDir();
   
  @@ -459,93 +464,10 @@
}
   }

  -public void findCompileList() throws BuildException {
  - findSourceFiles();
  - compileList=new Vector();
  -
  -for (int i = 0; i < srcList.size(); i++) {
  - Source source=(Source)srcList.elementAt(i);
  - File srcFile=source.getFile();
  -
  -if (!srcFile.exists()) {
  -throw new BuildException("Source \"" + srcFile.getPath() +
  - "\" does not exist!", location);
  -}
  -
  - // Check the dependency
  - if( needCompile( source ) ) 
  - compileList.addElement( source );
  - }
  -
  - if( checkDepend() ) {
  - log("Dependency expired, removing .o files and doing a full build ");
  - removeOFiles();
  - compileList=new Vector();
  - for(int i=0; i target.lastModified() ) {
  - oldestO=target.lastModified();
  - oldestOFile=target;
  - }
  - if( srcF.lastModified() > target.lastModified() )
  - return true;
  -
  - if( debug > 0 )
  - log("No need to compile " + srcF + " target " + target ); 
  - return false;
  -}
  -
  -public void removeOFiles( ) {
  - findSourceFiles();
  - compileList=new Vector();
  -
  -for (int i = 0; i < srcList.size(); i++) {
  - Source srcF=(Source)srcList.elementAt(i);
  - File srcFile = srcF.getFile();
  -
  - String name=srcFile.getName();
  - String targetNA[]=co_mapper.mapFileName( name );
  - if( targetNA==null )
  - continue;
  - File target=new File( buildDir, targetNA[0] );
  - // Check the dependency
  - if( target.exists() ) {
  - // Remove it - we'll do a full build
  - target.delete();
  - }
  - }
  -}
  -
  -public boolean checkDepend() {
  +/** If any file declared in  element has changed, we'll do
  +a full rebuild.
  +  

cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2001-11-16 Thread mmanders

mmanders01/11/16 13:32:16

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  Added alternate targets (since NLM names are limited to 8.3).
  
  Revision  ChangesPath
  1.20  +12 -0 
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SoTask.java   2001/11/12 23:34:47 1.19
  +++ SoTask.java   2001/11/16 21:32:16 1.20
  @@ -122,6 +122,7 @@
   protected Vector exports= new Vector(); // used by the NetWare, win32 
linkers
   protected Vector modules= new Vector(); // used by the NetWare linker
   protected Vector linkOpts   = new Vector(); // used by the NetWare, win32 
linkers
  +protected Vector altSoFiles = new Vector(); // used by the NetWare linker
   
   // Computed fields 
   protected Vector compileList; // [Source]
  @@ -164,6 +165,7 @@
so.compileList=compileList;
so.compiler=compiler;
so.co_mapper=co_mapper;
  + so.altSoFiles=altSoFiles;
   }
   
   /**  @deprecated use setTarget
  @@ -242,6 +244,16 @@
   public void addNLMModule(JkData module) {
module.setProject( project );
   modules.add(module);
  +}
  +
  +/**
  + * Add an alternate target since some platforms (NetWare) have file name
  + * limitations.
  + * 
  + */
  +public void addAltSoFile(JkData altSo) {
  + altSo.setProject( project );
  +altSoFiles.add(altSo);
   }
   
   /** Set the target for this compilation. Don't include any
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2001-11-12 Thread mmanders

mmanders01/11/12 15:34:47

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  Added a link options vector similar to imports, exports, etc.
  
  Revision  ChangesPath
  1.19  +18 -6 
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SoTask.java   2001/11/11 01:14:52 1.18
  +++ SoTask.java   2001/11/12 23:34:47 1.19
  @@ -117,10 +117,11 @@
   protected boolean optG=true;
   protected boolean optimize=false;
   protected boolean profile=false;
  -protected Vector defines = new Vector();
  -protected Vector imports = new Vector();// used by the NetWare linker
  -protected Vector exports = new Vector();// used by the NetWare linker
  -protected Vector modules = new Vector();// used by the NetWare linker
  +protected Vector defines= new Vector();
  +protected Vector imports= new Vector(); // used by the NetWare, win32 
linkers
  +protected Vector exports= new Vector(); // used by the NetWare, win32 
linkers
  +protected Vector modules= new Vector(); // used by the NetWare linker
  +protected Vector linkOpts   = new Vector(); // used by the NetWare, win32 
linkers
   
   // Computed fields 
   protected Vector compileList; // [Source]
  @@ -158,6 +159,7 @@
so.imports=imports;
so.exports=exports;
so.modules=modules;
  + so.linkOpts=linkOpts;
so.srcList=srcList;
so.compileList=compileList;
so.compiler=compiler;
  @@ -203,7 +205,7 @@
   }
   
   /**
  - * Add an import file/symbol for NetWare platform
  + * Add an import file/symbol for NetWare or win32 platform
*
* 
*/
  @@ -213,13 +215,23 @@
   }
   
   /**
  - * Add an export file/symbol for NetWare platform
  + * Add an export file/symbol for NetWare or win32 platform
*
* 
*/
   public void addExport(JkData exp) {
exp.setProject( project );
   exports.add(exp);
  +}
  +
  +/**
  + * Add a link option for NetWare or win32 platform
  + *
  + * 
  + */
  +public void addLinkOpt(JkData option) {
  + option.setProject( project );
  +linkOpts.add(option);
   }
   
   /**
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java ApxsTask.java

2001-11-02 Thread costin

costin  01/11/02 12:29:54

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Removed: jk/jkant/java/org/apache/jk/ant ApxsTask.java
  Log:
  Removed ApxsTask ( it was a placeholder).
  
  We can add it later as "ApxsCompiler/Linker" - it'll use whatever Apxs
  detected. The problem is that we can't deal with dependencies, so everything will
  be recompiled.
  
  An alternative is to use Apxs in query mode - then use normal compiler. Or for
  Apache2.0 to use the build/ directory where the information seems to be duplicated.
  
  SoTask - more refactoring. Regarding adapter selection - we use same mechansim as
  javac ( a project property ), but we could detect ( for example by searching
  the PATH or doing a dummy execute ) if gcc/libtool/etc are present and use
  them. Assuming someone will write the adapters for Windows, Netware, Borland, etc -
  this can also be detected using the platform id.
  
  Revision  ChangesPath
  1.8   +122 -240  
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SoTask.java   2001/10/30 20:55:38 1.7
  +++ SoTask.java   2001/11/02 20:29:54 1.8
  @@ -58,6 +58,7 @@
   import org.apache.tools.ant.util.*;
   import org.apache.tools.ant.taskdefs.*;
   import org.apache.tools.ant.*;
  +import org.apache.jk.ant.compilers.*;
   
   import java.io.*;
   import java.util.*;
  @@ -96,26 +97,74 @@
* @author Costin Manolache
*/
   public class SoTask extends Task {
  -String apxs;
  +protected String apxs;
   // or FileSet ?
  -FileSet src;
  -Path includes;
  -Path depends;
  -Path libs;
  -String module;
  -String soFile;
  -String cflags;
  -File buildDir;
  -int debug;
  -Vector defines = new Vector();
  +protected FileSet src;
  +protected Path includes;
  +protected Path depends;
  +protected Path libs;
  +protected String module;
  +protected String soFile;
  +protected String cflags;
  +protected File buildDir;
  +protected int debug;
  +
  +protected boolean optG=true;
  +protected boolean optimize=false;
  +protected Vector defines = new Vector();
  +
  +// Computed fields 
  +protected Vector compileList;
  +protected String srcList[];
   
   public SoTask() {};
   
  +// Hack to allow individual compilers/linkers to work
  +// as regular Tasks, independnetly.
  +public void duplicateTo(SoTask so) {
  + // This will act as a proxy for the child task 
  + so.project=project;
  + so.target=target;
  + so.location=location;
  + so.taskName=taskName;
  + so.taskType=taskType;
  + 
  + so.apxs=apxs;
  + so.src=src;
  + so.includes=includes;
  + so.depends=depends;
  + so.libs=libs;
  + so.module=module;
  + so.soFile=soFile;
  + so.cflags=cflags;
  + so.buildDir=buildDir;
  + so.debug=debug;
  + so.optG=optG;
  + so.optimize=optimize;
  + so.defines=defines;
  + so.srcList=srcList;
  + so.compileList=compileList;
  +}
  +
   public void setSoFile(String s ) {
soFile=s;
   }
   
  -public void setDebug(int i) {
  +/** Add debug information
  + */
  +public void setDebug(boolean b) {
  + optG=b;
  +}
  +
  +/** Add debug information
  + */
  +public void setOptimize(boolean b) {
  + optimize=b;
  +}
  +
  +/** Debug the  task
  + */
  +public void setTaskDebug(int i) {
debug=i;
   }
   
  @@ -207,22 +256,74 @@
   
   // XXX Add specific code for Linux and platforms where things are
   // clean, libtool should be just a fallback.
  -String srcList[];
  -
   public void execute() throws BuildException {
if( soFile==null )
throw new BuildException("No target ( .so file )");
if (src == null) 
   throw new BuildException("No source files");
  +
  + // XXX makedepend-type dependencies - how ??
  + // We could generate a dummy Makefile and parse the content...
  + findCompileList();
  +
  + CompilerAdapter compiler=findCompilerAdapter();
  + compiler.compile( compileList );
  + 
  + File soTarget=new File( buildDir, soFile + ".so" );
  + if( compileList.size() == 0 && soTarget.exists()) {
  + // No dependency, no need to relink
  + return;
  + }
  +
  + LinkerAdapter linker=findLinkerAdapter();
  + linker.link(srcList);
  +}
  +
  +public CompilerAdapter findCompilerAdapter() {
  + CompilerAdapter compilerAdapter;
  + String cc=project.getProperty("build.compiler.cc");
  + if( cc!=null ) {
  + if( "cc".equal

cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2001-10-27 Thread costin

costin  01/10/26 16:28:50

  Modified:jk/jkant/java/org/apache/jk/ant SoTask.java
  Log:
  Almost done.
  
  Compile all the .so files, dependencies, linking, etc. If libtool is available
  everything should work.
  
  Still need to clean up and better organize the source, merge the 'special' cases
  ( using the existing Makefiles for example, or what apxs is doing on window - I
  don't know and I can't test )
  
  If you have some time, please give it a try and let me know if it works for you
  Just type "ant jkant" in j-t-c/jk - on linux it should compile all .so files for
  apache2, apache13, jni. ( you may need to set some properties with your locations )
  
  Revision  ChangesPath
  1.5   +159 -24   
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SoTask.java   2001/10/26 22:53:56 1.4
  +++ SoTask.java   2001/10/26 23:28:50 1.5
  @@ -186,6 +186,7 @@
   
   // XXX Add specific code for Linux and platforms where things are
   // clean, libtool should be just a fallback.
  +String srcList[];
   
   public void execute() throws BuildException {
if( soFile==null )
  @@ -196,14 +197,14 @@
   if (buildDir == null) buildDir = project.getBaseDir();
   
DirectoryScanner ds=src.getDirectoryScanner( project );
  -String [] list = ds.getIncludedFiles(); 
  - if (list.length == 0) 
  + srcList= ds.getIncludedFiles(); 
  + if (srcList.length == 0) 
   throw new BuildException("No source files");
   
Vector compileList=new Vector();
   
  -for (int i = 0; i < list.length; i++) {
  - File srcFile = (File)project.resolveFile(list[i]);
  +for (int i = 0; i < srcList.length; i++) {
  + File srcFile = (File)project.resolveFile(srcList[i]);
   if (!srcFile.exists()) {
   throw new BuildException("Source \"" + srcFile.getPath() +
"\" does not exist!", location);
  @@ -224,15 +225,27 @@
File f=(File)en.nextElement();
executeLibtoolCompile(f.toString(), includeList );
}
  - 
   
  + File soTarget=new File( buildDir, soFile + ".so" );
  + if( compileList.size() == 0 && soTarget.exists()) {
  + // No dependency, no need to relink
  + return;
  + }
  +
  + executeLibtoolLink();
  + 
   }
   
   protected static GlobPatternMapper co_mapper=new GlobPatternMapper();
  +protected static GlobPatternMapper lo_mapper=new GlobPatternMapper();
   static {
co_mapper.setFrom("*.c");
co_mapper.setTo("*.o");
   }
  +static {
  + lo_mapper.setFrom("*.c");
  + lo_mapper.setTo("*.lo");
  +}
   
   /** Verify if a .c file needs compilation.
*   As with javac, we assume a fixed build structure, where all .o
  @@ -264,22 +277,35 @@

   }
   
  -/** Generate the .so file using 'standard' gcc flags. This assume
  - *  a 'current' gcc on a 'normal' platform. 
  +/** Compile  using 'standard' gcc flags. This assume a 'current' gcc on
  + *  a 'normal' platform - no need for libtool
*/
  -public void executeGcc() throws BuildException {
  -}
  -
  -/** Generate the .so file using libtool.
  - *  XXX check version, etc.
  - */
  -public void executeLibtoolCompile(String source, String includeList[]) throws 
BuildException {
  +public void executeGcc(String source, String includeList[]) throws 
BuildException {
Commandline cmd = new Commandline();
   
  - String libtool=project.getProperty("build.native.libtool");
  - if(libtool==null) libtool="libtool";
String cc=project.getProperty("build.native.cc");
if(cc==null) cc="gcc";
  + 
  + cmd.setExecutable( cc );
  + addCCArgs( cmd, source, includeList );
  +
  + int result=execute( cmd );
  + if( result!=0 ) {
  + log("Compile failed " + result + " " +  source );
  + log("Output:" );
  + if( outputstream!=null ) 
  + log( outputstream.toString());
  + log("StdErr:" );
  + if( errorstream!=null ) 
  + log( errorstream.toString());
  + 
  + throw new BuildException("Compile failed " + source);
  + }
  + closeStreamHandler();
  +
  +}
  +
  +private void addCCArgs(Commandline cmd, String source, String includeList[]) {
String extra_cflags=project.getProperty("build.native.extra_cflags");
String localCflags=cflags;
if( localCflags==null ) {
  @@ -290,12 +316,6 @@
}
}
   
  - cmd.setExecutable( libtool );
  - 

cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant SoTask.java

2001-10-26 Thread costin

costin  01/10/26 12:53:45

  Modified:jk/jkant ant.tasks
   jk/jkant/java/org/apache/jk/ant SoTask.java
  Added:   jk/native build.xml
  Log:
  A bit more code into the ant builder. Still broken, but can compile the common/
  files. From strange reasons {os.name} system property is Linux, so I can't
  use it for include.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jk/native/build.xml
  
  Index: build.xml
  ===
  
  

  

  
  



  

  











  
  

  
  
  
  
  1.2   +2 -1  jakarta-tomcat-connectors/jk/jkant/ant.tasks
  
  Index: ant.tasks
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/ant.tasks,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ant.tasks 2001/10/25 23:48:00 1.1
  +++ ant.tasks 2001/10/26 19:53:45 1.2
  @@ -1 +1,2 @@
  -apxs=org.apache.jk.ApxsTask
  \ No newline at end of file
  +apxs=org.apache.jk.ant.ApxsTask
  +so=org.apache.jk.ant.SoTask
  \ No newline at end of file
  
  
  
  1.2   +220 -24   
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SoTask.java   2001/10/25 23:48:00 1.1
  +++ SoTask.java   2001/10/26 19:53:45 1.2
  @@ -60,7 +60,26 @@
   import org.apache.tools.ant.*;
   
   import java.io.*;
  +import java.util.*;
   
  +/** Global properties
  +
  +Same idea as in javac, some user .properties will set the local preferences,
  +including machine-specific. If one is not specified we'll guess it. The
  +build file will be clean.
  +
  +TODO: can we get configure to generate such a file ? 
  +
  +build.native.cc=gcc
  +# Path to libtool ( used as a backup )
  +build.native.libtool=
  +# Platform-specific flags for compilation.
  +build.native.extra_cflags=
  +
  +
  +*/
  +
  +
   /**
* Task to generate a .so file, similar with ( or using ) libtool.
* I hate libtool, so long term I would like to replace most of it
  @@ -78,18 +97,40 @@
*/
   public class SoTask extends Task {
   String apxs;
  -Path src;
  -Path include;
  +// or FileSet ?
  +FileSet src;
  +Path includes;
   Path libs;
   String module;
  -
  +String soFile;
  +String cflags;
  +File buildDir;
  +
   public SoTask() {};
   
  -/**
  - *  Path to Apxs executable. Defaults to "apxs" using the current PATH.
  +public void setSoFile(String s ) {
  + soFile=s;
  +}
  +
  +public void setTarget(String s ) {
  + soFile=s;
  +}
  +
  +/** Directory where intermediary objects will be
  + *  generated
  + */
  +public void setBuildDir( File s ) {
  + buildDir=s;
  +}
  +
  +public void setCflags(String s ) {
  + cflags=s;
  +}
  +
  +/** Directory where the .so file will be generated
*/
  -public void setPath( String path ) {
  - this.apxs=path;
  +public void setSoDir( String s ) {
  + 
   }
   
   /**
  @@ -97,33 +138,25 @@
*
* @return a nexted src element.
*/
  -public Path createSrc() {
  -if (src == null) {
  -src = new Path(project);
  -}
  -return src.createPath();
  +public void addSrc(FileSet fl) {
  + src=fl;
   }
   
   /**
* Include files
*/
  -public Path createInclude() {
  -if (include == null) {
  -include = new Path(project);
  -}
  -return include.createPath();
  +public Path createIncludes() {
  + includes=new Path(project);
  + return includes;
   }
   
   /**
  - * Libraries ( .so or .dll ) files to link to.
  + * Libraries ( .a, .so or .dll ) files to link to.
*/
  -public Path createLib() {
  -if (libs == null) {
  -libs = new Path(project);
  -}
  -return libs.createPath();
  +public Path createLibs() {
  +libs=new Path(project);
  + return libs;
   }
  -
   
   
   /**
  @@ -134,10 +167,173 @@
   this.module = module;
   }
   
  +// XXX Add specific code for Netware, Windows and platforms where libtool
  +// is problematic
  +
  +// XXX Add specific code for Linux and platforms where things are
  +// clean, libtool should be just a fallback.
  +
   public void execute() throws BuildException {
  + if( soF