(SIGAR-214) properly adjust jni.javahome when JAVA_HOME is not set
This commit is contained in:
parent
9ce6361973
commit
4227bf6ab9
|
@ -54,15 +54,6 @@ USA.
|
||||||
<condition property="jni.javahome" value="${env.JAVA_HOME}">
|
<condition property="jni.javahome" value="${env.JAVA_HOME}">
|
||||||
<isset property="env.JAVA_HOME"/>
|
<isset property="env.JAVA_HOME"/>
|
||||||
</condition>
|
</condition>
|
||||||
<condition property="jni.javahome" value="${java.home}">
|
|
||||||
<not>
|
|
||||||
<isset property="jni.javahome"/>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<echo>java.home=${jni.javahome}</echo>
|
|
||||||
|
|
||||||
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
|
|
||||||
|
|
||||||
<condition property="linux">
|
<condition property="linux">
|
||||||
<equals arg1="${os.name}" arg2="Linux"/>
|
<equals arg1="${os.name}" arg2="Linux"/>
|
||||||
|
@ -180,6 +171,10 @@ USA.
|
||||||
|
|
||||||
<libarch/>
|
<libarch/>
|
||||||
|
|
||||||
|
<echo>java.home=${jni.javahome}</echo>
|
||||||
|
|
||||||
|
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
|
||||||
|
|
||||||
<property name="jni.project.archname"
|
<property name="jni.project.archname"
|
||||||
value="${project.name}-${jni.libarch}"/>
|
value="${project.name}-${jni.libarch}"/>
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,17 @@ public class ArchNameTask extends Task {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getProject().setProperty("jni.scmrev", getSourceRevision());
|
getProject().setProperty("jni.scmrev", getSourceRevision());
|
||||||
|
|
||||||
|
//jni.javahome required to find include/jni.h
|
||||||
|
String home = getProject().getProperty("jni.javahome");
|
||||||
|
if (home == null) {
|
||||||
|
home = System.getProperty("java.home");
|
||||||
|
}
|
||||||
|
File dir = new File(home);
|
||||||
|
if (!new File(dir, "include").exists()) {
|
||||||
|
dir = dir.getParentFile(); //was /jre
|
||||||
|
}
|
||||||
|
getProject().setProperty("jni.javahome", dir.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXX source rev stuff should be in another task
|
//XXX source rev stuff should be in another task
|
||||||
|
|
Loading…
Reference in New Issue