diff --git a/.github/workflows/build-win-msys2-ucrt64.yml b/.github/workflows/build-win-msys2-ucrt64.yml index 0e2bfa0..ee912f7 100644 --- a/.github/workflows/build-win-msys2-ucrt64.yml +++ b/.github/workflows/build-win-msys2-ucrt64.yml @@ -22,6 +22,7 @@ jobs: mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pcre2 mingw-w64-ucrt-x86_64-openssl + mingw-w64-ucrt-x86_64-zlib - name: set date shell: pwsh run: | @@ -31,6 +32,8 @@ jobs: echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: make Windows (Makefile.win) shell: msys2 {0} + env: + LIBSTATIC: 'true' run: make -f Makefile.win - name: make dist dir shell: cmd diff --git a/Makefile.win b/Makefile.win index a2e5211..518aff9 100644 --- a/Makefile.win +++ b/Makefile.win @@ -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 ifndef OPENSSL_CHECK -OPENSSL_CHECK = $(shell echo "\#include \\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 \\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) - LIBS += -l crypto -l ssl + LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) +else + ZLIB := endif PAM_CHECK = $(shell echo "\#include \\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) PLUGINS += PamAuth endif -PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include \\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 \\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) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) - PCRE_LIBS = -lpcre2-8 + PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) endif endif