Current File : /home/inlingua/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build_dll.patch
From 170f403ee2355d71dd6bca6ff463b7c341ad04dc Mon Sep 17 00:00:00 2001
From: Serhii Kupriienko
Date: Mon, 12 Feb 2024 15:55:52 +0200
Subject: [PATCH] Fix the dll creation, remove DESCRIPTION.
The following changes were taken from https://github.com/philr/bzip2-windows/tree/v1.0.8.0/patches.
They are licensed under the MIT and Copyright (c) 2015-2019 Philip Ross.

---
 libbz2.def   |  1 -
 makefile.msc | 30 ++++++++++++++++++------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/libbz2.def b/libbz2.def
index 2dc0dd8..b8de2aa 100644
--- a/libbz2.def
+++ b/libbz2.def
@@ -1,5 +1,4 @@
 LIBRARY			LIBBZ2
-DESCRIPTION		"libbzip2: library for data compression"
 EXPORTS
 	BZ2_bzCompressInit
 	BZ2_bzCompress
diff --git a/makefile.msc b/makefile.msc
index 799a18a..0e0bc85 100644
--- a/makefile.msc
+++ b/makefile.msc
@@ -14,14 +14,17 @@ OBJS= blocksort.obj  \
       decompress.obj \
       bzlib.obj
 
-all: lib bzip2 test
+all: dll lib bzip2 test
 
-bzip2: lib
-	$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
-	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
+bzip2: dll
+	$(CC) $(CFLAGS) /Febzip2 bzip2.c libbz2.lib setargv.obj
+	$(CC) $(CFLAGS) /Febzip2recover bzip2recover.c
+
+dll: $(OBJS) libbz2.def
+  link /dll /implib:libbz2.lib /out:libbz2.dll /def:libbz2.def $(OBJS)
 
 lib: $(OBJS)
-	lib /out:libbz2.lib $(OBJS)
+	lib /out:libbz2_static.lib $(OBJS)
 
 test: bzip2
 	type words1
@@ -37,7 +40,7 @@ test: bzip2
 	@echo is too clever for its own good.  Disable this option.
 	@echo The correct size for sample3.ref is 120,244.  If it
 	@echo is 150,251, WinZip has messed it up.
-	fc sample1.bz2 sample1.rb2 
+	fc sample1.bz2 sample1.rb2
 	fc sample2.bz2 sample2.rb2
 	fc sample3.bz2 sample3.rb2
 	fc sample1.tst sample1.ref
@@ -46,18 +49,21 @@ test: bzip2
 
 
 
-clean: 
+clean:
 	del *.obj
-	del libbz2.lib 
+	del libbz2.lib
+	del libbz2.dll
+  del libbz2.exp
+  del libbz2-static.lib
 	del bzip2.exe
 	del bzip2recover.exe
-	del sample1.rb2 
-	del sample2.rb2 
+	del sample1.rb2
+	del sample2.rb2
 	del sample3.rb2
-	del sample1.tst 
+	del sample1.tst
 	del sample2.tst
 	del sample3.tst
 
 .c.obj: 
-	$(CC) $(CFLAGS) -c $*.c -o $*.obj
+	$(CC) $(CFLAGS) -c $*.c /Fo$*.obj
 
-- 
2.39.0