use ArchNameTask to configure darwin sdk
This commit is contained in:
parent
fdc0cf5c1f
commit
6500952e5b
|
@ -25,7 +25,6 @@ USA.
|
|||
<property name="jni.src.java" value="src"/>
|
||||
<property name="jni.libprefix" value="java"/>
|
||||
<property name="jni.libversion" value=""/>
|
||||
<property name="uni.sdk.version" value="4u"/>
|
||||
<property name="osx.min" value="-mmacosx-version-min=10.3"/>
|
||||
|
||||
<property name="cpptasks.jar" location="lib/cpptasks.jar"/>
|
||||
|
@ -195,11 +194,6 @@ USA.
|
|||
|
||||
<property name="jni.objdir" value="${build}/obj/${jni.libarch}"/>
|
||||
|
||||
<condition property="uni.sdk"
|
||||
value="/Developer/SDKs/MacOSX10.${uni.sdk.version}.sdk">
|
||||
<istrue value="${darwin}"/>
|
||||
</condition>
|
||||
|
||||
<condition property="jni.cc" value="uni-cc">
|
||||
<isset property="darwin"/>
|
||||
</condition>
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
|
||||
package org.hyperic.jni;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
|
@ -78,5 +83,34 @@ public class ArchNameTask extends Task {
|
|||
getProject().setProperty("jni.gccm", "-m31");
|
||||
}
|
||||
}
|
||||
|
||||
if (ArchLoader.IS_DARWIN) {
|
||||
//default to most recent SDK
|
||||
//MacOSX10.3.9.sdk, MacOSX10.4u.sdk, MacOSX10.5.sdk,etc.
|
||||
File[] sdks =
|
||||
new File("/Developer/SDKs").listFiles(new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
String name = file.getName();
|
||||
return
|
||||
name.startsWith("MacOSX10.") &&
|
||||
name.endsWith(".sdk");
|
||||
}
|
||||
});
|
||||
if (sdks != null) {
|
||||
Arrays.sort(sdks, new Comparator() {
|
||||
public int compare(Object s1, Object s2) {
|
||||
return (int)(((File)s2).lastModified() -
|
||||
((File)s1).lastModified());
|
||||
}
|
||||
});
|
||||
final String prop = "uni.sdk";
|
||||
String sdk = getProject().getProperty(prop);
|
||||
if (sdk == null) {
|
||||
sdk = sdks[0].getPath();
|
||||
getProject().setProperty(prop, sdk);
|
||||
}
|
||||
System.out.println("Using SDK=" + sdk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue