Skip to content

Commit

Permalink
Use MinGW naming convention for Windows libraries
Browse files Browse the repository at this point in the history
For the import and static libraries, use the MinGW naming convention
(libdeflate.dll.a and libdeflate.a, respectively) instead of the Visual
Studio naming convention (libdeflate.lib and libdeflatestatic.lib,
respectively).  The original assumption was that the native Windows
convention was better.  However, instead people expect the naming
convention to reflect the toolchain with which the files were built.

Also change 'make install' to install the DLL into the bin directory
instead of the lib directory, again following the MinGW convention.

Fixes #190
  • Loading branch information
ebiggers committed Sep 17, 2022
1 parent 8a26b31 commit 3993137
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ LIBDIR ?= $(PREFIX)/lib

SOVERSION := 0

STATIC_LIB_SUFFIX := .a
IMPLIB :=
PROG_SUFFIX :=
PROG_CFLAGS :=
HARD_LINKS := 1
Expand All @@ -94,12 +94,12 @@ TARGET_MACHINE := $(shell $(CC) -dumpmachine 2>/dev/null)

# Compiling for Windows with MinGW or LLVM?
ifneq ($(findstring -mingw,$(TARGET_MACHINE))$(findstring -windows-gnu,$(TARGET_MACHINE)),)
STATIC_LIB_SUFFIX := static.lib
SHARED_LIB := libdeflate.dll
SHARED_LIB_SYMLINK :=
SHARED_LIB_CFLAGS :=
SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.lib \
SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.dll.a \
-Wl,--output-def,libdeflate.def
IMPLIB := libdeflate.dll.a
PROG_SUFFIX := .exe
PROG_CFLAGS := -static -municode
HARD_LINKS :=
Expand Down Expand Up @@ -188,7 +188,7 @@ DEFAULT_TARGETS :=

#### Library

STATIC_LIB := libdeflate$(STATIC_LIB_SUFFIX)
STATIC_LIB := libdeflate.a

LIB_CFLAGS += $(CFLAGS) -fvisibility=hidden -D_ANSI_SOURCE

Expand Down Expand Up @@ -345,7 +345,12 @@ install:all $(PKGCONFBASE)
$(DESTDIR)$(BINDIR)
install -m644 $(STATIC_LIB) $(DESTDIR)$(LIBDIR)
if [ -z "$(DISABLE_SHARED)" ]; then \
install -m755 $(SHARED_LIB) $(DESTDIR)$(LIBDIR); \
if [ -n "$(IMPLIB)" ]; then \
install -m755 $(SHARED_LIB) $(DESTDIR)$(BINDIR);\
install -m644 $(IMPLIB) $(DESTDIR)$(LIBDIR); \
else \
install -m755 $(SHARED_LIB) $(DESTDIR)$(LIBDIR);\
fi \
fi
sed -e "s|@LIBDIR@|$(LIBDIR)|" \
-e "s|@INCDIR@|$(INCDIR)|" \
Expand All @@ -369,11 +374,16 @@ install:all $(PKGCONFBASE)

uninstall:
rm -f $(DESTDIR)$(LIBDIR)/$(STATIC_LIB) \
$(DESTDIR)$(LIBDIR)/$(SHARED_LIB) \
$(DESTDIR)$(LIBDIR)/pkgconfig/libdeflate.pc \
$(DESTDIR)$(INCDIR)/libdeflate.h \
$(DESTDIR)$(BINDIR)/libdeflate-gzip$(PROG_SUFFIX) \
$(DESTDIR)$(BINDIR)/libdeflate-gunzip$(PROG_SUFFIX)
if [ -n "$(IMPLIB)" ]; then \
rm -f $(DESTDIR)$(BINDIR)/$(SHARED_LIB) \
$(DESTDIR)$(LIBDIR)/$(IMPLIB); \
else \
rm -f $(DESTDIR)$(LIBDIR)/$(SHARED_LIB); \
fi
if [ -n "$(SHARED_LIB_SYMLINK)" ]; then \
rm -f $(DESTDIR)$(LIBDIR)/$(SHARED_LIB_SYMLINK); \
fi
Expand Down
3 changes: 1 addition & 2 deletions scripts/make-windows-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ for arch in 'i686' 'x86_64'; do
dir=libdeflate-$(git describe --tags | tr -d v)-windows-${arch}-bin
rm -rf "$dir" "$dir.zip"
mkdir "$dir"
cp libdeflate.{dll,lib,def} libdeflatestatic.lib libdeflate.h ./*.exe \
"$dir"
cp libdeflate.{dll,dll.a,def,a} libdeflate.h ./*.exe "$dir"
${arch}-w64-mingw32-strip "$dir/libdeflate.dll" "$dir"/*.exe
for file in COPYING NEWS.md README.md; do
sed < $file > "$dir/${file}.txt" -e 's/$/\r/g'
Expand Down

0 comments on commit 3993137

Please sign in to comment.