Skip to content

Commit 9fd62df

Browse files
committed
Fix mingw builds on windows missing bz2.dll
Meson produces bz2.dll with msvc but libbz2.dll with mingw, and ignores the library name in the .def file. And of course both compilers just go ahead and generate an import library that pulls in a DLL different from what's in the .def file without questions.
1 parent aaae3cd commit 9fd62df

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.github/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,9 @@ function compile_bzip2() {
923923
get_and_cd bzip2-1.0.8.tar.gz bzip2_version
924924
dos2unix libbz2.def
925925
patch_breakpoint $patches_real/bzip2-meson.patch apply
926+
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-msvc ]]; then
927+
patch_breakpoint $patches_real/bzip2-msvc-libname.patch apply
928+
fi
926929
local meson_configure=meson$'\t'setup
927930
if [[ $BSH_DEBUG_RELEASE == release ]]; then
928931
meson_configure+=$'\t'-Dbuildtype=debugoptimized

patches/bzip2-meson.patch

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
diff -Naur bzip2-1.0.8.old/libbz2.def bzip2-1.0.8.new/libbz2.def
2-
--- bzip2-1.0.8.old/libbz2.def 2022-10-19 08:26:45.345787900 +0200
3-
+++ bzip2-1.0.8.new/libbz2.def 2022-10-19 08:26:45.392406700 +0200
4-
@@ -1,5 +1,4 @@
5-
-LIBRARY LIBBZ2
6-
-DESCRIPTION "libbzip2: library for data compression"
7-
+LIBRARY BZ2
8-
EXPORTS
9-
BZ2_bzCompressInit
10-
BZ2_bzCompress
111
diff -Naur bzip2-1.0.8.old/meson.build bzip2-1.0.8.new/meson.build
122
--- bzip2-1.0.8.old/meson.build 1970-01-01 01:00:00.000000000 +0100
133
+++ bzip2-1.0.8.new/meson.build 2022-10-19 08:26:45.392406700 +0200

patches/bzip2-msvc-libname.patch

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
diff -Naur bzip2-1.0.8.old/libbz2.def bzip2-1.0.8.new/libbz2.def
2+
--- bzip2-1.0.8.old/libbz2.def 2022-10-19 08:26:45.345787900 +0200
3+
+++ bzip2-1.0.8.new/libbz2.def 2022-10-19 08:26:45.392406700 +0200
4+
@@ -1,5 +1,4 @@
5+
-LIBRARY LIBBZ2
6+
-DESCRIPTION "libbzip2: library for data compression"
7+
+LIBRARY BZ2
8+
EXPORTS
9+
BZ2_bzCompressInit
10+
BZ2_bzCompress

0 commit comments

Comments
 (0)