From d28868966d973a9b09909567ae6522e182f87c9a Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 16 Aug 2021 02:56:27 -0700
Subject: [PATCH 21/25] Unvendor bzip2

---
 PCbuild/_bz2.vcxproj         | 15 +++++----------
 PCbuild/_bz2.vcxproj.filters | 26 +-------------------------
 2 files changed, 6 insertions(+), 35 deletions(-)

diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj
index 0402f7a9aa..569c7c5de9 100644
--- a/PCbuild/_bz2.vcxproj
+++ b/PCbuild/_bz2.vcxproj
@@ -94,7 +94,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(bz2Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(condaDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
@@ -102,20 +102,15 @@
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
     </ClCompile>
+    <Link>
+      <AdditionalDependencies>$(condaDir)\lib\bzip2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\_bz2module.c" />
-    <ClCompile Include="$(bz2Dir)\blocksort.c" />
-    <ClCompile Include="$(bz2Dir)\bzlib.c" />
-    <ClCompile Include="$(bz2Dir)\compress.c" />
-    <ClCompile Include="$(bz2Dir)\crctable.c" />
-    <ClCompile Include="$(bz2Dir)\decompress.c" />
-    <ClCompile Include="$(bz2Dir)\huffman.c" />
-    <ClCompile Include="$(bz2Dir)\randtable.c" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="$(bz2Dir)\bzlib.h" />
-    <ClInclude Include="$(bz2Dir)\bzlib_private.h" />
+    <ClInclude Include="$(condaDir)\include\bzlib.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\python_nt.rc" />
diff --git a/PCbuild/_bz2.vcxproj.filters b/PCbuild/_bz2.vcxproj.filters
index 7c0b516253..c1f960608c 100644
--- a/PCbuild/_bz2.vcxproj.filters
+++ b/PCbuild/_bz2.vcxproj.filters
@@ -21,33 +21,9 @@
     <ClCompile Include="..\Modules\_bz2module.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="$(bz2Dir)\blocksort.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\bzlib.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\compress.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\crctable.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\decompress.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\huffman.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
-    <ClCompile Include="$(bz2Dir)\randtable.c">
-      <Filter>Source Files\bzip2</Filter>
-    </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="$(bz2Dir)\bzlib_private.h">
-      <Filter>Header Files\bzip2</Filter>
-    </ClInclude>
-    <ClInclude Include="$(bz2Dir)\bzlib.h">
+    <ClInclude Include="$(condaDir)\include\bzlib.h">
       <Filter>Header Files\bzip2</Filter>
     </ClInclude>
   </ItemGroup>
-- 
2.30.2

