Load zlib, libewf, and crt from system path.

This commit is contained in:
Jeff Wallace 2013-11-20 11:21:43 -05:00
parent 3339994322
commit 8bb313d6b1
3 changed files with 188 additions and 2 deletions

View File

@ -26,8 +26,8 @@ import javafx.embed.swing.JFXPanel;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.modules.ModuleInstall; import org.openide.modules.ModuleInstall;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* Wrapper over Installers in packages in Core module This is the main * Wrapper over Installers in packages in Core module This is the main
@ -39,6 +39,56 @@ public class Installer extends ModuleInstall {
private static final Logger logger = Logger.getLogger(Installer.class.getName()); private static final Logger logger = Logger.getLogger(Installer.class.getName());
private static volatile boolean javaFxInit = false; private static volatile boolean javaFxInit = false;
static {
loadDynLibraries();
}
private static void loadDynLibraries() {
if (PlatformUtil.isWindowsOS()) {
try {
//on windows force loading ms crt dependencies first
//in case linker can't find them on some systems
//Note: if shipping with a different CRT version, this will only print a warning
//and try to use linker mechanism to find the correct versions of libs.
//We should update this if we officially switch to a new version of CRT/compiler
System.loadLibrary("msvcr100");
System.loadLibrary("msvcp100");
logger.log(Level.INFO, "MS CRT libraries loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ms crt libraries, ", e);
}
}
try {
System.loadLibrary("zlib");
logger.log(Level.INFO, "ZLIB library loaded loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ZLIB library, ", e);
}
try {
System.loadLibrary("libewf");
logger.log(Level.INFO, "EWF library loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading EWF library, ", e);
}
/* We should rename the Windows dll, to remove the lib prefix.
*/
// try {
// String tskLibName = null;
// if (PlatformUtil.isWindowsOS()) {
// tskLibName = "libtsk_jni";
// } else {
// tskLibName = "tsk_jni";
// }
// System.loadLibrary(tskLibName);
// logger.log(Level.INFO, "TSK_JNI library loaded");
// } catch (UnsatisfiedLinkError e) {
// logger.log(Level.SEVERE, "Error loading tsk_jni library", e);
// }
}
public Installer() { public Installer() {
logger.log(Level.INFO, "core installer created"); logger.log(Level.INFO, "core installer created");
javaFxInit = false; javaFxInit = false;

View File

@ -3,7 +3,128 @@
<!-- Need a way to specify TSK Debug versus Release --> <!-- Need a way to specify TSK Debug versus Release -->
<property name="TSK_BUILD_TYPE">Release</property> <property name="TSK_BUILD_TYPE">Release</property>
<!-- Directory paths -->
<property name="amd64" location="${basedir}/Core/release/modules/lib/amd64" />
<property name="x86" location="${basedir}/Core/release/modules/lib/x86" />
<property name="x86_64" location="${basedir}/Core/release/modules/lib/x86_64" />
<property name="i386" location="${basedir}/Core/release/modules/lib/i386" />
<property name="i586" location="${basedir}/Core/release/modules/lib/i586" />
<property name="i686" location="${basedir}/Core/release/modules/lib/i686"/>
<property name="crt" location="${basedir}/thirdparty/crt" />
<!-- NATIVE LIB TARGETS -->
<target name="copyLibs" depends="copyWinLibs64,copyWinLibs32" description="Copy windows dlls to the correct location." />
<target name="init-lib-path" description="Set up folder hierarchy under release/modules/lib">
<mkdir dir="${amd64}"/>
<mkdir dir="${x86_64}"/>
<mkdir dir="${x86}"/>
<mkdir dir="${i386}"/>
<mkdir dir="${i586}"/>
<mkdir dir="${i686}"/>
</target>
<target name="checkLibDirs" depends="init-lib-path">
<property environment="env"/>
<condition property="ewfFound">
<isset property="env.LIBEWF_HOME"/>
</condition>
<fail unless="ewfFound" message="LIBEWF_HOME must be set as an environment variable."/>
<property name="win64.lib.path" value="${env.TSK_HOME}/win32/x64/Release"/>
<property name="win32.lib.path" value="${env.TSK_HOME}/win32/Release" />
<available property="win64.exists" type="dir" file="${win64.lib.path}" />
<available property="win32.exists" type="dir" file="${win32.lib.path}" />
</target>
<target name="copyWinLibs64" depends="checkLibDirs" if="win64.exists">
<property name="win64dir" location="${win64.lib.path}" />
<fileset dir="${win64dir}" id="win64dlls">
<include name="libewf.dll" />
<include name="zlib.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
<fileset refid="win64dlls" />
</copy>
<copy todir="${x86_64}" overwrite="true">
<fileset refid="win64dlls" />
</copy>
</target>
<target name="copyWinLibs32" depends="checkLibDirs" if="win32.exists">
<property name="win32dir" location="${win32.lib.path}" />
<fileset dir="${win32dir}" id="win32dlls">
<include name="zlib.dll" />
<include name="libewf.dll"/>
</fileset>
<copy todir="${i386}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${x86}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i586}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i686}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
</target>
<!-- CRT LIBS TO ZIP -->
<target name="copyExternalLibsToZip" depends="copyCRT32,copyCRT64"/>
<target name="copyCRT32">
<property name="CRT.path" value="${thirdparty.dir}/crt/win32/crt.zip"/>
<available file="${CRT.path}" property="crtFound"/>
<fail unless="crtFound" message="CRT not found in the thirdparty repo in path: ${CRT.path}"/>
<property name="zip-lib-path" value="${zip-tmp}/${app.name}/${app.name}/modules/lib/"/>
<unzip src="${CRT.path}" dest="${zip-lib-path}/x86" overwrite="true"/>
<fileset dir="${zip-lib-path}/x86" id="crt32dlls">
<include name="*.dll"/>
</fileset>
<copy todir="${zip-lib-path}/i386" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
<copy todir="${zip-lib-path}/i586" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
<copy todir="${zip-lib-path}/i686" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
</target>
<target name="copyCRT64">
<property name="CRT.path" value="${thirdparty.dir}/crt/win64/crt.zip"/>
<available file="${CRT.path}" property="crtFound"/>
<fail unless="crtFound" message="CRT not found in the thirdparty repo in path: ${CRT.path}"/>
<property name="zip-lib-path" value="${zip-tmp}/${app.name}/${app.name}/modules/lib/"/>
<unzip src="${CRT.path}" dest="${zip-lib-path}/x86_64" overwrite="true"/>
<fileset dir="${zip-lib-path}/x86_64" id="crt32dlls">
<include name="*.dll"/>
</fileset>
<copy todir="${zip-lib-path}/amd64" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
</target>
<!-- ADVANCED INSTALLER TARGETS -->
<target name="build-installer-windows" depends="init-advanced-installer" <target name="build-installer-windows" depends="init-advanced-installer"
description="Makes an installer from the opened ZIP file"> description="Makes an installer from the opened ZIP file">
<antcall target="run-advanced-installer" /> <antcall target="run-advanced-installer" />

View File

@ -72,6 +72,12 @@
<unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/> <unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
<copy file="${basedir}/branding_${app.name}/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/> <copy file="${basedir}/branding_${app.name}/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/>
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyExternalLibsToZip"/>
</then>
</if>
<property name="app.property.file" value="${zip-tmp}/${app.name}/etc/${app.name}.conf" /> <property name="app.property.file" value="${zip-tmp}/${app.name}/etc/${app.name}.conf" />
<property name="jvm.options" value="&quot;--branding ${app.name} -J-Xms24m -J-XX:MaxPermSize=128M -J-Xverify:none -J-Xdock:name=${app.title}&quot;" /> <property name="jvm.options" value="&quot;--branding ${app.name} -J-Xms24m -J-XX:MaxPermSize=128M -J-Xverify:none -J-Xdock:name=${app.title}&quot;" />
@ -126,7 +132,16 @@
<property name="app.version" value="${DSTAMP}"/> <property name="app.version" value="${DSTAMP}"/>
</target> </target>
<target name="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit"> <target name="getExternals">
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyLibs"/>
</then>
</if>
</target>
<target name="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit,getExternals">
<convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id"/> <convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id"/>
<sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/> <sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
<property name="cluster" location="build/cluster"/> <property name="cluster" location="build/cluster"/>