costin 01/10/26 15:28:27
Modified: jk build.xml
jk/jkant/java/org/apache/jk/ant SoTask.java
jk/native build.xml
Added: jk/jkant/java/org/apache/jk/ant ApacheConfig.java
JniConfig.java
Log:
Another small step.
Now it compiles all the jni files ( no link, no dependencies ).
Revision Changes Path
1.14 +1 -1 jakarta-tomcat-connectors/jk/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.xml 2001/10/26 21:19:34 1.13
+++ build.xml 2001/10/26 22:28:27 1.14
@@ -154,7 +154,7 @@
<copy todir="${jkant.build}/classes/META-INF" file="jkant/ant.tasks"/>
<jar jarfile="${jkant.build}/jkant.jar"
basedir="${jkant.build}/classes" />
- <ant antfile="build.xml" dir="native" />
+ <ant dir="native" antfile="build.xml" />
</target>
1.3 +55 -52
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SoTask.java 2001/10/26 19:53:45 1.2
+++ SoTask.java 2001/10/26 22:28:27 1.3
@@ -105,12 +105,17 @@
String soFile;
String cflags;
File buildDir;
-
+ int debug;
+
public SoTask() {};
public void setSoFile(String s ) {
soFile=s;
}
+
+ public void setDebug(int i) {
+ debug=i;
+ }
public void setTarget(String s ) {
soFile=s;
@@ -132,7 +137,16 @@
public void setSoDir( String s ) {
}
+
+ public void addJniConfig( JniConfig jniCfg ) {
+
+ }
+
+ public void addApacheConfig( ApacheConfig apacheCfg ) {
+
+ }
+
/**
* Source files ( .c )
*
@@ -259,20 +273,29 @@
cmd.createArgument().setValue( source );
- execute( cmd );
+ 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();
}
// ==================== Execution utils ====================
-
- String output;
- String error;
ExecuteStreamHandler streamhandler = null;
- OutputStream outputstream = null;
- OutputStream errorstream = null;
+ ByteArrayOutputStream outputstream = null;
+ ByteArrayOutputStream errorstream = null;
- public void execute( Commandline cmd ) throws BuildException
+ public int execute( Commandline cmd ) throws BuildException
{
createStreamHandler();
Execute exe = new Execute(streamhandler, null);
@@ -283,57 +306,37 @@
exe.setWorkingDirectory(buildDir);
exe.setCommandline(cmd.getCommandline());
- try {
- exe.execute();
+ int result=0;
+ try {
+ result=exe.execute();
} catch (IOException e) {
throw new BuildException(e, location);
- } finally {
- closeStreamHandler();
- }
- }
-
- public void createStreamHandler() {
- if (error == null && output == null) {
- streamhandler = new LogStreamHandler(this, Project.MSG_INFO,
- Project.MSG_WARN);
- } else {
- if (output != null) {
- try {
- outputstream =
- new PrintStream(new BufferedOutputStream(new
FileOutputStream(output)));
- } catch (IOException e) {
- throw new BuildException(e,location);
- }
- }
- else {
- outputstream = new LogOutputStream(this,Project.MSG_INFO);
- }
- if (error != null) {
- try {
- errorstream =
- new PrintStream(new BufferedOutputStream(new
FileOutputStream(error)));
- } catch (IOException e) {
- throw new BuildException(e,location);
- }
- }
- else {
- errorstream = new LogOutputStream(this, Project.MSG_WARN);
- }
- streamhandler = new PumpStreamHandler(outputstream, errorstream);
- }
+ }
+ return result;
}
+ public void createStreamHandler() throws BuildException {
+ // try {
+ outputstream= new ByteArrayOutputStream();
+ errorstream = new ByteArrayOutputStream();
+
+ streamhandler =
+ new PumpStreamHandler(new PrintStream(outputstream),
+ new PrintStream(errorstream));
+ // } catch (IOException e) {
+ // throw new BuildException(e,location);
+ // }
+ }
+
public void closeStreamHandler() {
- if (output != null) {
- try {
+ try {
+ if (outputstream != null)
outputstream.close();
- } catch (IOException e) {}
- }
- if (error != null) {
- try {
+ if (errorstream != null)
errorstream.close();
- } catch (IOException e) {}
- }
+ outputstream=null;
+ errorstream=null;
+ } catch (IOException e) {}
}
}
1.1
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/ApacheConfig.java
Index: ApacheConfig.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
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 java.io.*;
import java.util.*;
/**
* Set preferences for compiling Apache modules.
* XXX will use apxs query to detect the flags.
*
* @author Costin Manolache
*/
public class ApacheConfig {
public ApacheConfig() {
}
public void setApxs( String s ) {
}
/** Return include path for Apache
*/
public String[] getIncludes() {
return null;
}
/** Return extra C flags that are needed to compile
*/
public String[] getCflags() {
return null;
}
public void execute() throws BuildException {
}
}
1.1
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/JniConfig.java
Index: JniConfig.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
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 java.io.*;
import java.util.*;
/* Base task for 'config guessers'.
* Each guesser will set properties based on OS, environment,
* properties, well-known locations, other programs.
*
* Examples:
* - set the required include files for JNI compilation
* - use apxs to detect apache directories and flags
*
* XXX Should be usable at top-level as well as in <so>
*/
/**
* Set preferences for compiling Jni .so files.
*
* @author Costin Manolache
*/
public class JniConfig {
String includes[];
public JniConfig() {
}
/** Return include path for JNI
*/
public String[] getIncludes() {
return null;
}
/** Return extra C flags that are needed to compile
*/
public String[] getCflags() {
return null;
}
public void execute() throws BuildException {
}
}
1.3 +42 -16 jakarta-tomcat-connectors/jk/native/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/build.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.xml 2001/10/26 21:19:35 1.2
+++ build.xml 2001/10/26 22:28:27 1.3
@@ -6,37 +6,63 @@
<pathelement location="../jkant/build/classes"/>
<pathelement location="../jkant/build/jkant.jar"/>
</path>
-
- <taskdef resource="META-INF/ant.tasks"
- classpathref="jkant" />
+ <property name="native.dir" location="." />
<property name="apxs13" value="/usr/sbin/apxs" />
<property name="apxs20" value="/opt/apache2/bin/apxs" />
<target name="main" >
- <!-- Guess/extract configuration informations
- -->
- <configJni id="jni" />
- <configApache13 id="apache13" />
- <configApache2 id="apache2" />
- <!-- configIIS id="iis" />
- <!-- configNES id="nes" />
-
- <so sofile="jni_connect" >
- <src dir=".">
+ <taskdef resource="META-INF/ant.tasks"
+ classpathref="jkant" />
+ <so sofile="jni_connect" buildDir="jni" >
+ <jniConfig />
+ <src dir="${native.dir}">
<include name="jni/jk_jnicb.c" />
<include name="common/jk_map.c" />
<include name="common/jk_util.c" />
<include name="common/jk_pool.c" />
</src>
+ <includes>
+ <pathelement location="${native.dir}/common" />
+ <pathelement location="${java.home}/../include" />
+ </includes>
+ </so>
+
+ <so sofile="mod_jk" buildDir="apache-2.0">
+ <apacheConfig apxs="${apxs20}" />
+ <jniConfig />
+ <src dir=".">
+ <include name="apache-2.0/mod_jk.c" />
+ <include name="common/*.c" />
+ </src>
<includes>
- <pathelement path="${java.home}/include" />
- <pathelement path="${java.home}/include/${os.name}" />
<pathelement location="../common" />
</includes>
- <cfg refid="jni" />
</so>
+ <so sofile="mod_jk" buildDir="apache-1.3">
+ <apacheConfig apxs="${apxs13}" />
+ <src dir=".">
+ <include name="apache-1.3/mod_jk.c" />
+ <include name="common/*.c" />
+ <exclude name="common/jk_jni_worker.c" />
+ </src>
+ <includes>
+ <pathelement location="../common" />
+ </includes>
+ </so>
+ </target>
+
+ <target name="clean" >
+ <delete >
+ <fileset dir=".">
+ <include name="**/*.o"/>
+ <include name="**/*.so"/>
+ <include name="**/*.lo"/>
+ <include name="**/*.la"/>
+ <include name="**/.libs"/>
+ </fileset>
+ </delete>
</target>
</project>