Skip to content

Commit

Permalink
build on OS X Yosemite.
Browse files Browse the repository at this point in the history
(cherry picked from commit a6a9dfb pull request hyperic#56)
  • Loading branch information
jdeolive committed Dec 21, 2016
1 parent ad47dc3 commit 196ef82
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ debian/files
config.sub*
config.guess*
bindings/java/${dist}
bindings/python/build
bindings/python/build
.DS_Store
2 changes: 1 addition & 1 deletion bindings/java/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<classpath refid="alljars"/>
</available>
<javac destdir="${build}/classes"
source="1.4" target="1.4"
source="1.5" target="1.5"
sourcepath=""
debug="true"
classpathref="libjars">
Expand Down
31 changes: 9 additions & 22 deletions bindings/java/hyperic_jni/jni-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<echo message="jni.src=${jni.src}, jni.jdk.os=${jni.jdk.os}, ${sun.arch.data.model}-bit"/>

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

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

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

<!-- ppc -->
<echo message="build 'ppc' arch"/>
<echo message="build 'x86_64' arch"/>
<antcall target="jni-cc" inheritRefs="true">
<param name="uni.arch" value="ppc"/>
<param name="uni.arch" value="x86_64"/>
</antcall>

<copy file="${shlib}" tofile="${shlib}.ppc"/>
<copy file="${shlib}" tofile="${shlib}.x86_64"/>

<!-- i386 -->
<echo message="build 'i386' arch"/>
<delete>
<fileset dir="${jni.objdir}" includes="*.o"/>
</delete>

<antcall target="jni-cc" inheritRefs="true">
<param name="uni.arch" value="i386"/>
</antcall>

<copy file="${shlib}" tofile="${shlib}.i386"/>

<echo message="lipo 'ppc'+'i386'"/>
<echo message="lipo 'x86_64'"/>
<exec executable="lipo">
<arg line="-create ${shlib}.ppc ${shlib}.i386 -output ${jni.objdir}/lib/lib${jni.libname}.dylib"/>
<arg line="-create ${shlib}.x86_64 -output ${jni.objdir}/lib/lib${jni.libname}.dylib"/>
</exec>

<delete>
<fileset dir="${jni.objdir}/lib" includes="*.ppc,*.i386"/>
<fileset dir="${jni.objdir}/lib" includes="*.x86_64"/>
</delete>
</target>

Expand Down Expand Up @@ -372,14 +358,15 @@
<!-- for Gestalt() -->
<linkerarg value="-framework"/>
<linkerarg value="CoreServices"/>
<linkerarg value="-framework"/>
<linkerarg value="IOKit"/>

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

<libset if="jni.libset.libs"
dir="${jni.libset.dir}"
libs="${jni.libset.libs}"/>

<syslibset libs="IOKit"/>
</linker>

<!-- Freebsd -->
Expand Down
13 changes: 12 additions & 1 deletion bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.FileReader;
import java.io.Reader;
import java.util.Arrays;
import java.util.Comparator;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
Expand Down Expand Up @@ -105,7 +106,17 @@ public boolean accept(File file) {
});

if (sdks != null) {
Arrays.sort(sdks);
Arrays.sort(sdks, new Comparator<File>() {

@Override
public int compare(File o1, File o2) {
String name1 = o1.getName();
String name2 = o2.getName();
String v1 = name1.substring("MacOSX10.".length(),name1.length()-".sdk".length());
String v2 = name2.substring("MacOSX10.".length(),name2.length()-".sdk".length());
return Integer.parseInt(v1)-Integer.parseInt(v2);
}
});
String prop = "uni.sdk";
String sdk = getProject().getProperty(prop);
String defaultMin = "10.3";
Expand Down

0 comments on commit 196ef82

Please sign in to comment.