Skip to content

Commit 196ef82

Browse files
committed
build on OS X Yosemite.
(cherry picked from commit a6a9dfb pull request hyperic#56)
1 parent ad47dc3 commit 196ef82

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ debian/files
3838
config.sub*
3939
config.guess*
4040
bindings/java/${dist}
41-
bindings/python/build
41+
bindings/python/build
42+
.DS_Store

bindings/java/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<classpath refid="alljars"/>
9797
</available>
9898
<javac destdir="${build}/classes"
99-
source="1.4" target="1.4"
99+
source="1.5" target="1.5"
100100
sourcepath=""
101101
debug="true"
102102
classpathref="libjars">

bindings/java/hyperic_jni/jni-build.xml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
<echo message="jni.src=${jni.src}, jni.jdk.os=${jni.jdk.os}, ${sun.arch.data.model}-bit"/>
162162

163163
<javac srcdir="${jni.src.java}" destdir="${build}/classes" debug="true"
164-
source="1.4" target="1.4"
164+
source="1.5" target="1.5"
165165
includes="org/hyperic/jni/*.java"/>
166166

167167
<taskdef name="libarch" classname="org.hyperic.jni.ArchNameTask">
@@ -224,37 +224,23 @@
224224
<antcall target="${jni.cc}" inheritRefs="true"/>
225225
</target>
226226

227-
<!-- run jni-cc twice {ppc,i386}, then feed both to lipo to build a universal binary -->
228227
<target name="uni-cc" if="jni.libarch">
229228
<property name="shlib" value="${jni.objdir}/lib/lib${jni.libname}.dylib"/>
230229

231-
<!-- ppc -->
232-
<echo message="build 'ppc' arch"/>
230+
<echo message="build 'x86_64' arch"/>
233231
<antcall target="jni-cc" inheritRefs="true">
234-
<param name="uni.arch" value="ppc"/>
232+
<param name="uni.arch" value="x86_64"/>
235233
</antcall>
236234

237-
<copy file="${shlib}" tofile="${shlib}.ppc"/>
235+
<copy file="${shlib}" tofile="${shlib}.x86_64"/>
238236

239-
<!-- i386 -->
240-
<echo message="build 'i386' arch"/>
241-
<delete>
242-
<fileset dir="${jni.objdir}" includes="*.o"/>
243-
</delete>
244-
245-
<antcall target="jni-cc" inheritRefs="true">
246-
<param name="uni.arch" value="i386"/>
247-
</antcall>
248-
249-
<copy file="${shlib}" tofile="${shlib}.i386"/>
250-
251-
<echo message="lipo 'ppc'+'i386'"/>
237+
<echo message="lipo 'x86_64'"/>
252238
<exec executable="lipo">
253-
<arg line="-create ${shlib}.ppc ${shlib}.i386 -output ${jni.objdir}/lib/lib${jni.libname}.dylib"/>
239+
<arg line="-create ${shlib}.x86_64 -output ${jni.objdir}/lib/lib${jni.libname}.dylib"/>
254240
</exec>
255241

256242
<delete>
257-
<fileset dir="${jni.objdir}/lib" includes="*.ppc,*.i386"/>
243+
<fileset dir="${jni.objdir}/lib" includes="*.x86_64"/>
258244
</delete>
259245
</target>
260246

@@ -372,14 +358,15 @@
372358
<!-- for Gestalt() -->
373359
<linkerarg value="-framework"/>
374360
<linkerarg value="CoreServices"/>
361+
<linkerarg value="-framework"/>
362+
<linkerarg value="IOKit"/>
375363

376364
<linkerarg value="-sectcreate,__TEXT,__info_plist,${jni.info.plist}" if="jni.info.plist"/>
377365

378366
<libset if="jni.libset.libs"
379367
dir="${jni.libset.dir}"
380368
libs="${jni.libset.libs}"/>
381369

382-
<syslibset libs="IOKit"/>
383370
</linker>
384371

385372
<!-- Freebsd -->

bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.FileReader;
2525
import java.io.Reader;
2626
import java.util.Arrays;
27+
import java.util.Comparator;
2728

2829
import org.apache.tools.ant.Task;
2930
import org.apache.tools.ant.BuildException;
@@ -105,7 +106,17 @@ public boolean accept(File file) {
105106
});
106107

107108
if (sdks != null) {
108-
Arrays.sort(sdks);
109+
Arrays.sort(sdks, new Comparator<File>() {
110+
111+
@Override
112+
public int compare(File o1, File o2) {
113+
String name1 = o1.getName();
114+
String name2 = o2.getName();
115+
String v1 = name1.substring("MacOSX10.".length(),name1.length()-".sdk".length());
116+
String v2 = name2.substring("MacOSX10.".length(),name2.length()-".sdk".length());
117+
return Integer.parseInt(v1)-Integer.parseInt(v2);
118+
}
119+
});
109120
String prop = "uni.sdk";
110121
String sdk = getProject().getProperty(prop);
111122
String defaultMin = "10.3";

0 commit comments

Comments
 (0)