Skip to content
Snippets Groups Projects
Commit df643eb3 authored by Brian Carrier's avatar Brian Carrier
Browse files

Merge pull request #208 from jawallace/master

Mac OS X Datamodel
parents 2977651c 3cd72f4d
No related branches found
No related tags found
No related merge requests found
......@@ -37,13 +37,26 @@
<property environment="env"/>
<copy file="./jni/.libs/libtsk_jni.dylib" tofile="./libtsk_jni.jnilib"/>
</target>
<target name="copyMacLibs" depends="testTSKLibs" if="tsk_dylib.present">
<property environment="env"/>
<property name="jni.dylib" location="${basedir}/jni/.libs/libtsk_jni.dylib" />
<property name="jni.jnilib" value="libtsk_jni.jnilib" />
<copy file="${jni.dylib}" tofile="${x86_64}/mac/${jni.jnilib}"/>
</target>
<!-- Non-OS X -->
<target name="copyTskLibs_so" depends="testTSKLibs" if="tsk_so.present">
<property environment="env"/>
<copy file="./jni/.libs/libtsk_jni.so" tofile="./libtsk_jni.so"/>
</target>
<target name="copyUnixLibs" depends="testTSKLibs" if="tsk_so.present">
<!-- does nothing for now -->
</target>
<target name="copyLibs" depends="copyUnixLibs,copyMacLibs" />
<target name="copyTSKLibs" depends="copyTskLibs_so,copyTskLibs_dylib">
<!-- depends targets take care of the actual copying since the file differs on OS X and Linux -->
<!-- This assumes that TSK, libewf, and zlib have been installed on the system and those libraries will be with normal loading approaches -->
......
......@@ -33,4 +33,63 @@
<sysproperty key="types" value="${test-types}"/>
</java>
</target>
<target name="copyLibs" depends="copyWinLibs" description="Copy native libs to the correct folder" />
<target name="copyWinLibs" depends="copyWinLibs64,copyWinLibs32" description="Copy windows dlls to the correct location." />
<target name="checkLibDirs">
<available property="win64.exists" type="dir" file="${basedir}/../../win32/x64/Release" />
<available property="win32.exists" type="dir" file="${basedir}/../../win32/Release" />
</target>
<target name="copyWinLibs64" depends="checkLibDirs" if="win64.exists">
<property name="win64dir" location="${basedir}/../../win32/x64/Release" />
<fileset dir="${win64dir}" id="win64dlls">
<include name="*.dll" />
</fileset>
<copy todir="${amd64}/win">
<fileset refid="win64dlls" />
</copy>
<copy todir="${x86_64}/win">
<fileset refid="win64dlls" />
</copy>
<fileset dir="${crt}/win64" id="crt64dlls">
<include name="*.dll" />
</fileset>
<copy todir="${amd64}/win">
<fileset refid="crt64dlls" />
</copy>
<copy todir="${x86_64}/win">
<fileset refid="crt64dlls" />
</copy>
</target>
<target name="copyWinLibs32" depends="checkLibDirs" if="win32.exists">
<property name="win32dir" location="${basedir}/../../win32/Release" />
<fileset dir="${win32dir}" id="win32dlls">
<include name="*.dll" />
</fileset>
<copy todir="${i386}/win">
<fileset refid="win32dlls" />
</copy>
<copy todir="${x86}/win">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i586}/win">
<fileset refid="win32dlls" />
</copy>
<fileset dir="${crt}/win32" id="crt32dlls">
<include name="*.dll" />
</fileset>
<copy todir="${i386}/win">
<fileset refid="crt32dlls" />
</copy>
<copy todir="${x86}/win">
<fileset refid="crt32dlls" />
</copy>
<copy todir="${i586}/win">
<fileset refid="crt32dlls" />
</copy>
</target>
</project>
......@@ -50,6 +50,7 @@
<mkdir dir="${x86}/win" />
<mkdir dir="${x86_64}" />
<mkdir dir="${x86_64}/win" />
<mkdir dir="${x86_64}/mac" />
<mkdir dir="${i386}" />
<mkdir dir="${i386}/win" />
<mkdir dir="${i586}" />
......@@ -64,7 +65,6 @@
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<available file="${ivy.jar.file}" property="ivy.available"/>
<antcall target="-download-ivy" />
......@@ -112,64 +112,7 @@ pattern="lib/[artifact]-[revision](-[classifier]).[ext]" />
<jar jarfile="${dist}/Tsk_DataModel.jar" basedir="${build}"/>
</target>
<target name="copyLibs" depends="copyWinLibs" description="Copy native libs to the correct folder" />
<target name="copyWinLibs" depends="copyWinLibs64,copyWinLibs32" description="Copy windows dlls to the correct location." />
<target name="checkLibDirs">
<available property="win64.exists" type="dir" file="${basedir}/../../win32/x64/Release" />
<available property="win32.exists" type="dir" file="${basedir}/../../win32/Release" />
</target>
<target name="copyWinLibs64" depends="checkLibDirs" if="win64.exists">
<property name="win64dir" location="${basedir}/../../win32/x64/Release" />
<fileset dir="${win64dir}" id="win64dlls">
<include name="*.dll" />
</fileset>
<copy todir="${amd64}/win">
<fileset refid="win64dlls" />
</copy>
<copy todir="${x86_64}/win">
<fileset refid="win64dlls" />
</copy>
<fileset dir="${crt}/win64" id="crt64dlls">
<include name="*.dll" />
</fileset>
<copy todir="${amd64}/win">
<fileset refid="crt64dlls" />
</copy>
<copy todir="${x86_64}/win">
<fileset refid="crt64dlls" />
</copy>
</target>
<target name="copyWinLibs32" depends="checkLibDirs" if="win32.exists">
<property name="win32dir" location="${basedir}/../../win32/Release" />
<fileset dir="${win32dir}" id="win32dlls">
<include name="*.dll" />
</fileset>
<copy todir="${i386}/win">
<fileset refid="win32dlls" />
</copy>
<copy todir="${x86}/win">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i586}/win">
<fileset refid="win32dlls" />
</copy>
<fileset dir="${crt}/win32" id="crt32dlls">
<include name="*.dll" />
</fileset>
<copy todir="${i386}/win">
<fileset refid="crt32dlls" />
</copy>
<copy todir="${x86}/win">
<fileset refid="crt32dlls" />
</copy>
<copy todir="${i586}/win">
<fileset refid="crt32dlls" />
</copy>
</target>
<target name="jni" depends="compile" description="make the jni.h file">
<javah classpath = "${build}" outputFile="jni/dataModel_SleuthkitJNI.h" force="yes">
......
......@@ -23,7 +23,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.Files;
/**
* Collection of methods to load libraries embedded in the TSK Datamodel Jar file.
......@@ -85,8 +84,17 @@ public static String getPlatform() {
public static boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows");
}
/**
* Is the platform Mac?
*
* @return
*/
private static boolean isMac() {
return System.getProperty("os.name").toLowerCase().contains("mac");
}
/**
* Attempt to extract and load the specified library.
*
* @param library
......@@ -122,7 +130,7 @@ public static void loadLibrary(Lib library) {
if(libTemp.exists()) {
// Delete old file
Files.delete(libTemp.toPath());
libTemp.delete();
}
InputStream in = libraryURL.openStream();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment