Support static libraries in Makefile.win

This commit is contained in:
Vladimir Dubrovin 2026-07-10 12:10:01 +03:00
parent fdda69c1f4
commit b7769d05af
2 changed files with 14 additions and 4 deletions

View File

@ -22,6 +22,7 @@ jobs:
mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-pcre2 mingw-w64-ucrt-x86_64-pcre2
mingw-w64-ucrt-x86_64-openssl mingw-w64-ucrt-x86_64-openssl
mingw-w64-ucrt-x86_64-zlib
- name: set date - name: set date
shell: pwsh shell: pwsh
run: | run: |
@ -31,6 +32,8 @@ jobs:
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: make Windows (Makefile.win) - name: make Windows (Makefile.win)
shell: msys2 {0} shell: msys2 {0}
env:
LIBSTATIC: 'true'
run: make -f Makefile.win run: make -f Makefile.win
- name: make dist dir - name: make dist dir
shell: cmd shell: cmd

View File

@ -37,21 +37,28 @@ BUILDDATE := $(BUILDDATE)
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
ifndef OPENSSL_CHECK ifndef OPENSSL_CHECK
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false) ifeq ($(LIBSTATIC), true)
STATIC_PREFIX = -Wl,-Bstatic
STATIC_SUFFIX = -Wl,-Bdynamic
ZLIB = -lz
endif
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
ifeq ($(OPENSSL_CHECK), true) ifeq ($(OPENSSL_CHECK), true)
LIBS += -l crypto -l ssl LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX)
CFLAGS += -DWITH_SSL CFLAGS += -DWITH_SSL
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
else
ZLIB :=
endif endif
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false) PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
ifeq ($(PAM_CHECK), true) ifeq ($(PAM_CHECK), true)
PLUGINS += PamAuth PLUGINS += PamAuth
endif endif
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include <pcre2.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -lpcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false) PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include <pcre2.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
ifeq ($(PCRE_CHECK), true) ifeq ($(PCRE_CHECK), true)
CFLAGS += -DWITH_PCRE CFLAGS += -DWITH_PCRE
PCRE_OBJS = pcre$(OBJSUFFICS) PCRE_OBJS = pcre$(OBJSUFFICS)
PCRE_LIBS = -lpcre2-8 PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
endif endif
endif endif