From d720cee5704eab274d2621a978bb40b2924979d0 Mon Sep 17 00:00:00 2001
From: "Peter J. Martel" <pmartel@basistech.com>
Date: Wed, 9 Nov 2011 16:34:40 -0500
Subject: [PATCH] Pull CRT assembly into zip distribution

Add target that (on Windows) copies Microsoft C++ Runtime libraries and manifest from a folder specified in an enviroment variable.
---
 build-unix.xml    |  2 ++
 build-windows.xml | 15 +++++++++++++++
 build.xml         |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/build-unix.xml b/build-unix.xml
index 2cb9866ffb..620f80d32e 100644
--- a/build-unix.xml
+++ b/build-unix.xml
@@ -5,4 +5,6 @@
         <!-- <copy file="${env.TSK_HOME}/win32/libewf/msvscpp/Release/libewf.dll" tofile="${basedir}/DataModel/release/modules/lib/libewf.dll"/> 
         <copy file="${env.TSK_HOME}/win32/libewf/msvscpp/zlib/zlib1.dll" tofile="${basedir}/DataModel/release/modules/lib/zlib1.dll"/> -->
     </target>
+    <target name="copyExternalLibs">
+    </target>
 </project>
diff --git a/build-windows.xml b/build-windows.xml
index aef7006231..9d4b51e8fc 100644
--- a/build-windows.xml
+++ b/build-windows.xml
@@ -11,4 +11,19 @@
         <copy file="${env.LIBEWF_HOME}/msvscpp/Release/libewf.dll" tofile="${basedir}/DataModel/release/modules/lib/libewf.dll"/> 
         <copy file="${env.LIBEWF_HOME}/msvscpp/zlib/zlib1.dll" tofile="${basedir}/DataModel/release/modules/lib/zlib1.dll"/>
     </target>
+    
+    <target name="copyExternalLibs">
+        
+        <!-- Get C++ Runtime dlls -->
+        <property environment="env"/>
+        <condition property="crtFound">
+            <isset property="env.CRT_HOME"/>
+        </condition>
+        <fail unless="crtFound" message="CRT_HOME must be set as an environment variable."/>
+
+        <copy file="${env.CRT_HOME}/Microsoft.VC90.CRT.manifest" tofile="${zip-tmp}/${app.name}/${app.name}/modules/lib/Microsoft.VC90.CRT.manifest"/>
+        <copy file="${env.CRT_HOME}/msvcm90.dll" tofile="${zip-tmp}/${app.name}/${app.name}/modules/lib/msvcm90.dll"/> 
+        <copy file="${env.CRT_HOME}/msvcp90.dll" tofile="${zip-tmp}/${app.name}/${app.name}/modules/lib/msvcp90.dll"/> 
+        <copy file="${env.CRT_HOME}/msvcr90.dll" tofile="${zip-tmp}/${app.name}/${app.name}/modules/lib/msvcr90.dll"/> 
+    </target>
 </project>
diff --git a/build.xml b/build.xml
index 614f35e862..c19260cf52 100644
--- a/build.xml
+++ b/build.xml
@@ -30,7 +30,6 @@
         </condition>
         <fail unless="tskFound" message="TSK_HOME must be set as an environment variable."/>
         <echo> TSK_HOME: ${env.TSK_HOME}</echo>
-        
     </target>
 
     <target name="getExternals" depends="findTSK,copyTSKLibs">
@@ -57,6 +56,7 @@
         <!-- step (3) do your copying stuff here, check the ant doc for copy, move, etc file -->
         <copy file="${basedir}/README.txt" tofile="${zip-tmp}/${app.name}/README.txt"/>
         <copy file="${basedir}/LICENSE-2.0.txt" tofile="${zip-tmp}/${app.name}/LICENSE-2.0.txt"/>
+        <antcall target="copyExternalLibs"></antcall>
         
         <!-- step (4) zip again, but with the version numbers in the dir -->
         <zip destfile="${nbdist.dir}/${app.name}-${app.version}.zip">
-- 
GitLab